Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 7904af1

Browse files
peffgitster
authored andcommitted
t1411: add more selector index/date tests
We already check that @{now} and "--date" cause the displayed selector to use the date for both the multiline and oneline formats. However, we miss several cases: 1. The --format=%gd selector is not tested at all. 2. We do not check how the log.date config interacts with the "--date" magic (according to f4ea32f, it should not impact the output). Doing so reveals that the combination of both (log.date combined with the %gd format) does not behave as expected. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8258858 commit 7904af1

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

t/t1411-reflog-show.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ test_expect_success 'using @{now} syntax shows reflog date (oneline)' '
6464
test_cmp expect actual
6565
'
6666

67+
cat >expect <<'EOF'
68+
HEAD@{Thu Apr 7 15:13:13 2005 -0700}
69+
EOF
70+
test_expect_success 'using @{now} syntax shows reflog date (format=%gd)' '
71+
git log -g -1 --format=%gd HEAD@{now} >actual &&
72+
test_cmp expect actual
73+
'
74+
6775
cat >expect <<'EOF'
6876
Reflog: HEAD@{1112911993 -0700} (C O Mitter <[email protected]>)
6977
Reflog message: commit (initial): one
@@ -82,6 +90,43 @@ test_expect_success 'using --date= shows reflog date (oneline)' '
8290
test_cmp expect actual
8391
'
8492

93+
cat >expect <<'EOF'
94+
HEAD@{1112911993 -0700}
95+
EOF
96+
test_expect_success 'using --date= shows reflog date (format=%gd)' '
97+
git log -g -1 --format=%gd --date=raw >actual &&
98+
test_cmp expect actual
99+
'
100+
101+
cat >expect <<'EOF'
102+
Reflog: HEAD@{0} (C O Mitter <[email protected]>)
103+
Reflog message: commit (initial): one
104+
EOF
105+
test_expect_success 'log.date does not invoke "--date" magic (multiline)' '
106+
test_config log.date raw &&
107+
git log -g -1 >tmp &&
108+
grep ^Reflog <tmp >actual &&
109+
test_cmp expect actual
110+
'
111+
112+
cat >expect <<'EOF'
113+
e46513e HEAD@{0}: commit (initial): one
114+
EOF
115+
test_expect_success 'log.date does not invoke "--date" magic (oneline)' '
116+
test_config log.date raw &&
117+
git log -g -1 --oneline >actual &&
118+
test_cmp expect actual
119+
'
120+
121+
cat >expect <<'EOF'
122+
HEAD@{0}
123+
EOF
124+
test_expect_failure 'log.date does not invoke "--date" magic (format=%gd)' '
125+
test_config log.date raw &&
126+
git log -g -1 --format=%gd >actual &&
127+
test_cmp expect actual
128+
'
129+
85130
: >expect
86131
test_expect_success 'empty reflog file' '
87132
git branch empty &&

0 commit comments

Comments
 (0)