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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed May 4, 2012 at 01:23 UTC 7904af1c10d2feb2f6d1dcb22454d93168a88c49
1 file changed +45
t/t1411-reflog-show.sh
+45
@@ -64,6 +64,14 @@ test_expect_success 'using @{now} syntax shows reflog date (oneline)' '
64 test_cmp expect actual
65 '
66
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 +
75 cat >expect <<'EOF'
76 Reflog: HEAD@{1112911993 -0700} (C O Mitter <committer@example.com>)
77 Reflog message: commit (initial): one
@@ -82,6 +90,43 @@ test_expect_success 'using --date= shows reflog date (oneline)' '
90 test_cmp expect actual
91 '
92
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 <committer@example.com>)
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 +
130 : >expect
131 test_expect_success 'empty reflog file' '
132 git branch empty &&