2007-03-28 00:08:28 +00:00
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
2013-06-26 10:19:49 +00:00
|
|
|
|
# Copyright (c) 2009 Jens Lehmann
|
|
|
|
|
# Copyright (c) 2011 Alexey Shumkin (+ non-UTF-8 commit encoding tests)
|
|
|
|
|
|
2007-07-03 05:52:14 +00:00
|
|
|
|
test_description='git rev-list --pretty=format test'
|
2007-03-28 00:08:28 +00:00
|
|
|
|
|
|
|
|
|
. ./test-lib.sh
|
2012-12-17 22:56:49 +00:00
|
|
|
|
. "$TEST_DIRECTORY"/lib-terminal.sh
|
2007-03-28 00:08:28 +00:00
|
|
|
|
|
|
|
|
|
test_tick
|
2013-07-05 12:01:48 +00:00
|
|
|
|
# String "added" in German
|
|
|
|
|
# (translated with Google Translate),
|
|
|
|
|
# encoded in UTF-8, used as a commit log message below.
|
2013-06-26 10:19:49 +00:00
|
|
|
|
added=$(printf "added (hinzugef\303\274gt) foo")
|
2013-07-04 12:45:46 +00:00
|
|
|
|
added_iso88591=$(echo "$added" | iconv -f utf-8 -t iso8859-1)
|
2013-06-26 10:19:49 +00:00
|
|
|
|
# same but "changed"
|
|
|
|
|
changed=$(printf "changed (ge\303\244ndert) foo")
|
2013-07-04 12:45:46 +00:00
|
|
|
|
changed_iso88591=$(echo "$changed" | iconv -f utf-8 -t iso8859-1)
|
2013-06-26 10:19:49 +00:00
|
|
|
|
|
2007-03-28 00:08:28 +00:00
|
|
|
|
test_expect_success 'setup' '
|
2013-06-26 10:19:46 +00:00
|
|
|
|
: >foo &&
|
|
|
|
|
git add foo &&
|
2013-07-04 12:45:46 +00:00
|
|
|
|
git config i18n.commitEncoding iso8859-1 &&
|
2013-06-26 10:19:49 +00:00
|
|
|
|
git commit -m "$added_iso88591" &&
|
2013-06-26 10:19:46 +00:00
|
|
|
|
head1=$(git rev-parse --verify HEAD) &&
|
|
|
|
|
head1_short=$(git rev-parse --verify --short $head1) &&
|
|
|
|
|
tree1=$(git rev-parse --verify HEAD:) &&
|
|
|
|
|
tree1_short=$(git rev-parse --verify --short $tree1) &&
|
2013-06-26 10:19:49 +00:00
|
|
|
|
echo "$changed" > foo &&
|
|
|
|
|
git commit -a -m "$changed_iso88591" &&
|
2013-06-26 10:19:46 +00:00
|
|
|
|
head2=$(git rev-parse --verify HEAD) &&
|
|
|
|
|
head2_short=$(git rev-parse --verify --short $head2) &&
|
|
|
|
|
tree2=$(git rev-parse --verify HEAD:) &&
|
|
|
|
|
tree2_short=$(git rev-parse --verify --short $tree2)
|
2013-06-26 10:19:49 +00:00
|
|
|
|
git config --unset i18n.commitEncoding
|
2007-03-28 00:08:28 +00:00
|
|
|
|
'
|
|
|
|
|
|
2013-07-05 12:01:48 +00:00
|
|
|
|
# usage: test_format name format_string [failure] <expected_output
|
2012-12-17 22:56:23 +00:00
|
|
|
|
test_format () {
|
2007-03-28 00:08:28 +00:00
|
|
|
|
cat >expect.$1
|
2013-07-05 12:01:48 +00:00
|
|
|
|
test_expect_${3:-success} "format $1" "
|
|
|
|
|
git rev-list --pretty=format:'$2' master >output.$1 &&
|
|
|
|
|
test_cmp expect.$1 output.$1
|
|
|
|
|
"
|
2007-03-28 00:08:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-17 22:56:49 +00:00
|
|
|
|
# Feed to --format to provide predictable colored sequences.
|
|
|
|
|
AUTO_COLOR='%C(auto,red)foo%C(auto,reset)'
|
|
|
|
|
has_color () {
|
|
|
|
|
printf '\033[31mfoo\033[m\n' >expect &&
|
|
|
|
|
test_cmp expect "$1"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
has_no_color () {
|
|
|
|
|
echo foo >expect &&
|
|
|
|
|
test_cmp expect "$1"
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-26 10:19:46 +00:00
|
|
|
|
test_format percent %%h <<EOF
|
|
|
|
|
commit $head2
|
2010-01-13 17:35:31 +00:00
|
|
|
|
%h
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head1
|
2010-01-13 17:35:31 +00:00
|
|
|
|
%h
|
|
|
|
|
EOF
|
|
|
|
|
|
2013-06-26 10:19:46 +00:00
|
|
|
|
test_format hash %H%n%h <<EOF
|
|
|
|
|
commit $head2
|
|
|
|
|
$head2
|
|
|
|
|
$head2_short
|
|
|
|
|
commit $head1
|
|
|
|
|
$head1
|
|
|
|
|
$head1_short
|
2007-03-28 00:08:28 +00:00
|
|
|
|
EOF
|
|
|
|
|
|
2013-06-26 10:19:46 +00:00
|
|
|
|
test_format tree %T%n%t <<EOF
|
|
|
|
|
commit $head2
|
|
|
|
|
$tree2
|
|
|
|
|
$tree2_short
|
|
|
|
|
commit $head1
|
|
|
|
|
$tree1
|
|
|
|
|
$tree1_short
|
2007-03-28 00:08:28 +00:00
|
|
|
|
EOF
|
|
|
|
|
|
2013-06-26 10:19:46 +00:00
|
|
|
|
test_format parents %P%n%p <<EOF
|
|
|
|
|
commit $head2
|
|
|
|
|
$head1
|
|
|
|
|
$head1_short
|
|
|
|
|
commit $head1
|
2007-03-28 20:33:37 +00:00
|
|
|
|
|
|
|
|
|
|
2007-03-28 00:08:28 +00:00
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
# we don't test relative here
|
2013-06-26 10:19:46 +00:00
|
|
|
|
test_format author %an%n%ae%n%ad%n%aD%n%at <<EOF
|
|
|
|
|
commit $head2
|
2007-03-28 00:08:28 +00:00
|
|
|
|
A U Thor
|
|
|
|
|
author@example.com
|
|
|
|
|
Thu Apr 7 15:13:13 2005 -0700
|
|
|
|
|
Thu, 7 Apr 2005 15:13:13 -0700
|
|
|
|
|
1112911993
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head1
|
2007-03-28 00:08:28 +00:00
|
|
|
|
A U Thor
|
|
|
|
|
author@example.com
|
|
|
|
|
Thu Apr 7 15:13:13 2005 -0700
|
|
|
|
|
Thu, 7 Apr 2005 15:13:13 -0700
|
|
|
|
|
1112911993
|
|
|
|
|
EOF
|
|
|
|
|
|
2013-06-26 10:19:46 +00:00
|
|
|
|
test_format committer %cn%n%ce%n%cd%n%cD%n%ct <<EOF
|
|
|
|
|
commit $head2
|
2007-03-28 00:08:28 +00:00
|
|
|
|
C O Mitter
|
|
|
|
|
committer@example.com
|
|
|
|
|
Thu Apr 7 15:13:13 2005 -0700
|
|
|
|
|
Thu, 7 Apr 2005 15:13:13 -0700
|
|
|
|
|
1112911993
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head1
|
2007-03-28 00:08:28 +00:00
|
|
|
|
C O Mitter
|
|
|
|
|
committer@example.com
|
|
|
|
|
Thu Apr 7 15:13:13 2005 -0700
|
|
|
|
|
Thu, 7 Apr 2005 15:13:13 -0700
|
|
|
|
|
1112911993
|
|
|
|
|
EOF
|
|
|
|
|
|
2013-06-26 10:19:46 +00:00
|
|
|
|
test_format encoding %e <<EOF
|
|
|
|
|
commit $head2
|
2013-07-04 12:45:46 +00:00
|
|
|
|
iso8859-1
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head1
|
2013-07-04 12:45:46 +00:00
|
|
|
|
iso8859-1
|
2007-03-28 00:08:28 +00:00
|
|
|
|
EOF
|
|
|
|
|
|
2013-06-26 10:19:50 +00:00
|
|
|
|
test_format subject %s <<EOF
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head2
|
2013-06-26 10:19:49 +00:00
|
|
|
|
$changed
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head1
|
2013-06-26 10:19:49 +00:00
|
|
|
|
$added
|
2007-03-28 00:08:28 +00:00
|
|
|
|
EOF
|
|
|
|
|
|
2013-06-26 10:19:46 +00:00
|
|
|
|
test_format body %b <<EOF
|
|
|
|
|
commit $head2
|
|
|
|
|
commit $head1
|
2007-03-28 00:08:28 +00:00
|
|
|
|
EOF
|
|
|
|
|
|
2013-06-26 10:19:50 +00:00
|
|
|
|
test_format raw-body %B <<EOF
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head2
|
2013-06-26 10:19:49 +00:00
|
|
|
|
$changed
|
2010-03-25 02:51:52 +00:00
|
|
|
|
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head1
|
2013-06-26 10:19:49 +00:00
|
|
|
|
$added
|
2010-03-25 02:51:52 +00:00
|
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
2013-06-26 10:19:46 +00:00
|
|
|
|
test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<EOF
|
|
|
|
|
commit $head2
|
2007-03-28 00:08:28 +00:00
|
|
|
|
[31mfoo[32mbar[34mbaz[mxyzzy
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head1
|
2007-03-28 00:08:28 +00:00
|
|
|
|
[31mfoo[32mbar[34mbaz[mxyzzy
|
|
|
|
|
EOF
|
|
|
|
|
|
2013-06-26 10:19:46 +00:00
|
|
|
|
test_format advanced-colors '%C(red yellow bold)foo%C(reset)' <<EOF
|
|
|
|
|
commit $head2
|
expand --pretty=format color options
Currently, the only colors available to --pretty=format
users are red, green, and blue. Rather than expand it with a
few new colors, this patch makes the usual config color
syntax available, including more colors, backgrounds, and
attributes.
Because colors are no longer bounded to a single word (e.g.,
%Cred), this uses a more advanced syntax that features a
beginning and end delimiter (but the old syntax still
works). So you can now do:
git log --pretty=tformat:'%C(yellow)%h%C(reset) %s'
to emulate --pretty=oneline, or even
git log --pretty=tformat:'%C(cyan magenta bold)%s%C(reset)'
if you want to relive the awesomeness of 4-color CGA.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-17 15:38:46 +00:00
|
|
|
|
[1;31;43mfoo[m
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head1
|
expand --pretty=format color options
Currently, the only colors available to --pretty=format
users are red, green, and blue. Rather than expand it with a
few new colors, this patch makes the usual config color
syntax available, including more colors, backgrounds, and
attributes.
Because colors are no longer bounded to a single word (e.g.,
%Cred), this uses a more advanced syntax that features a
beginning and end delimiter (but the old syntax still
works). So you can now do:
git log --pretty=tformat:'%C(yellow)%h%C(reset) %s'
to emulate --pretty=oneline, or even
git log --pretty=tformat:'%C(cyan magenta bold)%s%C(reset)'
if you want to relive the awesomeness of 4-color CGA.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-17 15:38:46 +00:00
|
|
|
|
[1;31;43mfoo[m
|
|
|
|
|
EOF
|
|
|
|
|
|
2012-12-17 22:56:49 +00:00
|
|
|
|
test_expect_success '%C(auto) does not enable color by default' '
|
|
|
|
|
git log --format=$AUTO_COLOR -1 >actual &&
|
|
|
|
|
has_no_color actual
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success '%C(auto) enables colors for color.diff' '
|
|
|
|
|
git -c color.diff=always log --format=$AUTO_COLOR -1 >actual &&
|
|
|
|
|
has_color actual
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success '%C(auto) enables colors for color.ui' '
|
|
|
|
|
git -c color.ui=always log --format=$AUTO_COLOR -1 >actual &&
|
|
|
|
|
has_color actual
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success '%C(auto) respects --color' '
|
|
|
|
|
git log --format=$AUTO_COLOR -1 --color >actual &&
|
|
|
|
|
has_color actual
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success '%C(auto) respects --no-color' '
|
|
|
|
|
git -c color.ui=always log --format=$AUTO_COLOR -1 --no-color >actual &&
|
|
|
|
|
has_no_color actual
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success TTY '%C(auto) respects --color=auto (stdout is tty)' '
|
|
|
|
|
(
|
|
|
|
|
TERM=vt100 && export TERM &&
|
|
|
|
|
test_terminal \
|
|
|
|
|
git log --format=$AUTO_COLOR -1 --color=auto >actual &&
|
|
|
|
|
has_color actual
|
|
|
|
|
)
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success '%C(auto) respects --color=auto (stdout not tty)' '
|
|
|
|
|
(
|
|
|
|
|
TERM=vt100 && export TERM &&
|
|
|
|
|
git log --format=$AUTO_COLOR -1 --color=auto >actual &&
|
|
|
|
|
has_no_color actual
|
|
|
|
|
)
|
|
|
|
|
'
|
|
|
|
|
|
2013-06-26 10:19:49 +00:00
|
|
|
|
iconv -f utf-8 -t iso8859-1 > commit-msg <<EOF
|
2007-03-28 21:08:36 +00:00
|
|
|
|
Test printing of complex bodies
|
|
|
|
|
|
|
|
|
|
This commit message is much longer than the others,
|
|
|
|
|
and it will be encoded in iso8859-1. We should therefore
|
2013-06-26 10:19:49 +00:00
|
|
|
|
include an iso8859 character: ¡bueno!
|
2007-03-28 21:08:36 +00:00
|
|
|
|
EOF
|
2013-06-26 10:19:46 +00:00
|
|
|
|
|
2007-03-28 21:08:36 +00:00
|
|
|
|
test_expect_success 'setup complex body' '
|
2013-06-26 10:19:46 +00:00
|
|
|
|
git config i18n.commitencoding iso8859-1 &&
|
|
|
|
|
echo change2 >foo && git commit -a -F commit-msg &&
|
|
|
|
|
head3=$(git rev-parse --verify HEAD) &&
|
2013-07-05 12:01:49 +00:00
|
|
|
|
head3_short=$(git rev-parse --short $head3)
|
2007-03-28 21:08:36 +00:00
|
|
|
|
'
|
|
|
|
|
|
2013-06-26 10:19:46 +00:00
|
|
|
|
test_format complex-encoding %e <<EOF
|
|
|
|
|
commit $head3
|
2007-03-28 21:08:36 +00:00
|
|
|
|
iso8859-1
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head2
|
2013-07-04 12:45:46 +00:00
|
|
|
|
iso8859-1
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head1
|
2013-07-04 12:45:46 +00:00
|
|
|
|
iso8859-1
|
2007-03-28 21:08:36 +00:00
|
|
|
|
EOF
|
|
|
|
|
|
2013-06-26 10:19:50 +00:00
|
|
|
|
test_format complex-subject %s <<EOF
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head3
|
2007-03-28 21:08:36 +00:00
|
|
|
|
Test printing of complex bodies
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head2
|
2013-07-05 12:01:49 +00:00
|
|
|
|
$changed_iso88591
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head1
|
2013-07-05 12:01:49 +00:00
|
|
|
|
$added_iso88591
|
2007-03-28 21:08:36 +00:00
|
|
|
|
EOF
|
|
|
|
|
|
2013-07-05 12:01:49 +00:00
|
|
|
|
test_expect_success 'prepare expected messages (for test %b)' '
|
|
|
|
|
cat <<-EOF >expected.utf-8 &&
|
|
|
|
|
commit $head3
|
|
|
|
|
This commit message is much longer than the others,
|
|
|
|
|
and it will be encoded in iso8859-1. We should therefore
|
|
|
|
|
include an iso8859 character: ¡bueno!
|
|
|
|
|
|
|
|
|
|
commit $head2
|
|
|
|
|
commit $head1
|
|
|
|
|
EOF
|
|
|
|
|
iconv -f utf-8 -t iso8859-1 expected.utf-8 >expected.iso8859-1
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_format complex-body %b <expected.iso8859-1
|
2007-03-28 21:08:36 +00:00
|
|
|
|
|
2013-07-05 12:01:49 +00:00
|
|
|
|
# Git uses i18n.commitEncoding if no i18n.logOutputEncoding set
|
|
|
|
|
# so unset i18n.commitEncoding to test encoding conversion
|
|
|
|
|
git config --unset i18n.commitEncoding
|
|
|
|
|
|
|
|
|
|
test_format complex-subject-commitencoding-unset %s <<EOF
|
|
|
|
|
commit $head3
|
|
|
|
|
Test printing of complex bodies
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head2
|
2013-07-05 12:01:49 +00:00
|
|
|
|
$changed
|
2013-06-26 10:19:46 +00:00
|
|
|
|
commit $head1
|
2013-07-05 12:01:49 +00:00
|
|
|
|
$added
|
2007-03-28 21:08:36 +00:00
|
|
|
|
EOF
|
|
|
|
|
|
2013-07-05 12:01:49 +00:00
|
|
|
|
test_format complex-body-commitencoding-unset %b <expected.utf-8
|
|
|
|
|
|
2010-10-07 18:25:43 +00:00
|
|
|
|
test_expect_success '%x00 shows NUL' '
|
2013-06-26 10:19:46 +00:00
|
|
|
|
echo >expect commit $head3 &&
|
2010-10-07 18:25:43 +00:00
|
|
|
|
echo >>expect fooQbar &&
|
|
|
|
|
git rev-list -1 --format=foo%x00bar HEAD >actual.nul &&
|
|
|
|
|
nul_to_q <actual.nul >actual &&
|
|
|
|
|
test_cmp expect actual
|
|
|
|
|
'
|
|
|
|
|
|
2008-08-29 00:54:59 +00:00
|
|
|
|
test_expect_success '%ad respects --date=' '
|
|
|
|
|
echo 2005-04-07 >expect.ad-short &&
|
|
|
|
|
git log -1 --date=short --pretty=tformat:%ad >output.ad-short master &&
|
|
|
|
|
test_cmp expect.ad-short output.ad-short
|
|
|
|
|
'
|
|
|
|
|
|
2008-01-06 12:21:07 +00:00
|
|
|
|
test_expect_success 'empty email' '
|
|
|
|
|
test_tick &&
|
|
|
|
|
C=$(GIT_AUTHOR_EMAIL= git commit-tree HEAD^{tree} </dev/null) &&
|
|
|
|
|
A=$(git show --pretty=format:%an,%ae,%ad%n -s $C) &&
|
|
|
|
|
test "$A" = "A U Thor,,Thu Apr 7 15:14:13 2005 -0700" || {
|
|
|
|
|
echo "Eh? $A" >failure
|
|
|
|
|
false
|
|
|
|
|
}
|
|
|
|
|
'
|
|
|
|
|
|
2009-10-05 06:43:32 +00:00
|
|
|
|
test_expect_success 'del LF before empty (1)' '
|
|
|
|
|
git show -s --pretty=format:"%s%n%-b%nThanks%n" HEAD^^ >actual &&
|
2012-04-11 11:24:01 +00:00
|
|
|
|
test_line_count = 2 actual
|
2009-10-05 06:43:32 +00:00
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success 'del LF before empty (2)' '
|
|
|
|
|
git show -s --pretty=format:"%s%n%-b%nThanks%n" HEAD >actual &&
|
2012-04-11 11:24:01 +00:00
|
|
|
|
test_line_count = 6 actual &&
|
2009-10-05 06:43:32 +00:00
|
|
|
|
grep "^$" actual
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success 'add LF before non-empty (1)' '
|
|
|
|
|
git show -s --pretty=format:"%s%+b%nThanks%n" HEAD^^ >actual &&
|
2012-04-11 11:24:01 +00:00
|
|
|
|
test_line_count = 2 actual
|
2009-10-05 06:43:32 +00:00
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success 'add LF before non-empty (2)' '
|
|
|
|
|
git show -s --pretty=format:"%s%+b%nThanks%n" HEAD >actual &&
|
2012-04-11 11:24:01 +00:00
|
|
|
|
test_line_count = 6 actual &&
|
2009-10-05 06:43:32 +00:00
|
|
|
|
grep "^$" actual
|
|
|
|
|
'
|
|
|
|
|
|
2010-06-14 16:12:29 +00:00
|
|
|
|
test_expect_success 'add SP before non-empty (1)' '
|
|
|
|
|
git show -s --pretty=format:"%s% bThanks" HEAD^^ >actual &&
|
2013-06-26 10:19:49 +00:00
|
|
|
|
test $(wc -w <actual) = 3
|
2010-06-14 16:12:29 +00:00
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success 'add SP before non-empty (2)' '
|
|
|
|
|
git show -s --pretty=format:"%s% sThanks" HEAD^^ >actual &&
|
2013-06-26 10:19:49 +00:00
|
|
|
|
test $(wc -w <actual) = 6
|
2010-06-14 16:12:29 +00:00
|
|
|
|
'
|
|
|
|
|
|
2010-05-04 03:18:57 +00:00
|
|
|
|
test_expect_success '--abbrev' '
|
|
|
|
|
echo SHORT SHORT SHORT >expect2 &&
|
|
|
|
|
echo LONG LONG LONG >expect3 &&
|
|
|
|
|
git log -1 --format="%h %h %h" HEAD >actual1 &&
|
|
|
|
|
git log -1 --abbrev=5 --format="%h %h %h" HEAD >actual2 &&
|
|
|
|
|
git log -1 --abbrev=5 --format="%H %H %H" HEAD >actual3 &&
|
|
|
|
|
sed -e "s/$_x40/LONG/g" -e "s/$_x05/SHORT/g" <actual2 >fuzzy2 &&
|
|
|
|
|
sed -e "s/$_x40/LONG/g" -e "s/$_x05/SHORT/g" <actual3 >fuzzy3 &&
|
|
|
|
|
test_cmp expect2 fuzzy2 &&
|
|
|
|
|
test_cmp expect3 fuzzy3 &&
|
|
|
|
|
! test_cmp actual1 actual2
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success '%H is not affected by --abbrev-commit' '
|
|
|
|
|
git log -1 --format=%H --abbrev-commit --abbrev=20 HEAD >actual &&
|
|
|
|
|
len=$(wc -c <actual) &&
|
|
|
|
|
test $len = 41
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success '%h is not affected by --abbrev-commit' '
|
|
|
|
|
git log -1 --format=%h --abbrev-commit --abbrev=20 HEAD >actual &&
|
|
|
|
|
len=$(wc -c <actual) &&
|
|
|
|
|
test $len = 21
|
|
|
|
|
'
|
|
|
|
|
|
2009-10-19 15:48:10 +00:00
|
|
|
|
test_expect_success '"%h %gD: %gs" is same as git-reflog' '
|
|
|
|
|
git reflog >expect &&
|
|
|
|
|
git log -g --format="%h %gD: %gs" >actual &&
|
|
|
|
|
test_cmp expect actual
|
|
|
|
|
'
|
|
|
|
|
|
|
|
|
|
test_expect_success '"%h %gD: %gs" is same as git-reflog (with date)' '
|
|
|
|
|
git reflog --date=raw >expect &&
|
|
|
|
|
git log -g --format="%h %gD: %gs" --date=raw >actual &&
|
|
|
|
|
test_cmp expect actual
|
|
|
|
|
'
|
|
|
|
|
|
2010-05-04 03:18:57 +00:00
|
|
|
|
test_expect_success '"%h %gD: %gs" is same as git-reflog (with --abbrev)' '
|
|
|
|
|
git reflog --abbrev=13 --date=raw >expect &&
|
|
|
|
|
git log -g --abbrev=13 --format="%h %gD: %gs" --date=raw >actual &&
|
|
|
|
|
test_cmp expect actual
|
|
|
|
|
'
|
|
|
|
|
|
2009-10-19 15:48:10 +00:00
|
|
|
|
test_expect_success '%gd shortens ref name' '
|
|
|
|
|
echo "master@{0}" >expect.gd-short &&
|
|
|
|
|
git log -g -1 --format=%gd refs/heads/master >actual.gd-short &&
|
|
|
|
|
test_cmp expect.gd-short actual.gd-short
|
|
|
|
|
'
|
|
|
|
|
|
2011-12-16 11:40:24 +00:00
|
|
|
|
test_expect_success 'reflog identity' '
|
|
|
|
|
echo "C O Mitter:committer@example.com" >expect &&
|
|
|
|
|
git log -g -1 --format="%gn:%ge" >actual &&
|
|
|
|
|
test_cmp expect actual
|
|
|
|
|
'
|
|
|
|
|
|
2010-03-21 14:40:16 +00:00
|
|
|
|
test_expect_success 'oneline with empty message' '
|
|
|
|
|
git commit -m "dummy" --allow-empty &&
|
|
|
|
|
git commit -m "dummy" --allow-empty &&
|
|
|
|
|
git filter-branch --msg-filter "sed -e s/dummy//" HEAD^^.. &&
|
2010-04-17 02:29:18 +00:00
|
|
|
|
git rev-list --oneline HEAD >test.txt &&
|
2012-04-11 11:24:01 +00:00
|
|
|
|
test_line_count = 5 test.txt &&
|
|
|
|
|
git rev-list --oneline --graph HEAD >testg.txt &&
|
|
|
|
|
test_line_count = 5 testg.txt
|
2010-03-21 14:40:16 +00:00
|
|
|
|
'
|
|
|
|
|
|
2012-05-22 06:12:20 +00:00
|
|
|
|
test_expect_success 'single-character name is parsed correctly' '
|
|
|
|
|
git commit --author="a <a@example.com>" --allow-empty -m foo &&
|
|
|
|
|
echo "a <a@example.com>" >expect &&
|
|
|
|
|
git log -1 --format="%an <%ae>" >actual &&
|
|
|
|
|
test_cmp expect actual
|
|
|
|
|
'
|
|
|
|
|
|
2007-03-28 00:08:28 +00:00
|
|
|
|
test_done
|