Browse Source

i18n: git-commit print_summary messages

Gettextize the "(root-commit)" and "detached HEAD" fragments that
appear when you commit either the root commit, or a commit in a
detached head translatable.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Ævar Arnfjörð Bjarmason 14 years ago committed by Junio C Hamano
parent
commit
7f5673d703
  1. 4
      builtin/commit.c
  2. 10
      t/t7502-commit.sh

4
builtin/commit.c

@ -1223,9 +1223,9 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
!prefixcmp(head, "refs/heads/") ? !prefixcmp(head, "refs/heads/") ?
head + 11 : head + 11 :
!strcmp(head, "HEAD") ? !strcmp(head, "HEAD") ?
"detached HEAD" : _("detached HEAD") :
head, head,
initial_commit ? " (root-commit)" : ""); initial_commit ? _(" (root-commit)") : "");


if (!log_tree_commit(&rev, commit)) { if (!log_tree_commit(&rev, commit)) {
rev.always_show_header = 1; rev.always_show_header = 1;

10
t/t7502-commit.sh

@ -22,7 +22,10 @@ check_summary_oneline() {
SUMMARY_POSTFIX="$(git log -1 --pretty='format:%h')" SUMMARY_POSTFIX="$(git log -1 --pretty='format:%h')"
echo "[$SUMMARY_PREFIX $SUMMARY_POSTFIX] $2" >exp && echo "[$SUMMARY_PREFIX $SUMMARY_POSTFIX] $2" >exp &&


test_cmp exp act if test_have_prereq C_LOCALE_OUTPUT
then
test_cmp exp act
fi
} }


test_expect_success 'output summary format' ' test_expect_success 'output summary format' '
@ -32,7 +35,10 @@ test_expect_success 'output summary format' '
check_summary_oneline "root-commit" "initial" && check_summary_oneline "root-commit" "initial" &&


echo change >>file1 && echo change >>file1 &&
git add file1 && git add file1
'

test_expect_success 'output summary format: root-commit' '
check_summary_oneline "" "a change" check_summary_oneline "" "a change"
' '



Loading…
Cancel
Save