aboutsummaryrefslogtreecommitdiff
path: root/t/t1411-reflog-show.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-05-04 01:23:14 -0400
committerJunio C Hamano <gitster@pobox.com>2012-05-04 09:39:14 -0700
commit7904af1c10d2feb2f6d1dcb22454d93168a88c49 (patch)
tree6fe6f5e6ffe3aa623960a9370cd98e17da46d967 /t/t1411-reflog-show.sh
parent8258858493ad3504630c3bfa7dfde61df811994a (diff)
downloadgit-7904af1c10d2feb2f6d1dcb22454d93168a88c49.tar.gz
git-7904af1c10d2feb2f6d1dcb22454d93168a88c49.tar.xz
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>
Diffstat (limited to 't/t1411-reflog-show.sh')
-rwxr-xr-xt/t1411-reflog-show.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/t/t1411-reflog-show.sh b/t/t1411-reflog-show.sh
index caa687b5b..4706f4c50 100755
--- a/t/t1411-reflog-show.sh
+++ b/t/t1411-reflog-show.sh
@@ -65,6 +65,14 @@ test_expect_success 'using @{now} syntax shows reflog date (oneline)' '
'
cat >expect <<'EOF'
+HEAD@{Thu Apr 7 15:13:13 2005 -0700}
+EOF
+test_expect_success 'using @{now} syntax shows reflog date (format=%gd)' '
+ git log -g -1 --format=%gd HEAD@{now} >actual &&
+ test_cmp expect actual
+'
+
+cat >expect <<'EOF'
Reflog: HEAD@{1112911993 -0700} (C O Mitter <committer@example.com>)
Reflog message: commit (initial): one
EOF
@@ -82,6 +90,43 @@ test_expect_success 'using --date= shows reflog date (oneline)' '
test_cmp expect actual
'
+cat >expect <<'EOF'
+HEAD@{1112911993 -0700}
+EOF
+test_expect_success 'using --date= shows reflog date (format=%gd)' '
+ git log -g -1 --format=%gd --date=raw >actual &&
+ test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+Reflog: HEAD@{0} (C O Mitter <committer@example.com>)
+Reflog message: commit (initial): one
+EOF
+test_expect_success 'log.date does not invoke "--date" magic (multiline)' '
+ test_config log.date raw &&
+ git log -g -1 >tmp &&
+ grep ^Reflog <tmp >actual &&
+ test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+e46513e HEAD@{0}: commit (initial): one
+EOF
+test_expect_success 'log.date does not invoke "--date" magic (oneline)' '
+ test_config log.date raw &&
+ git log -g -1 --oneline >actual &&
+ test_cmp expect actual
+'
+
+cat >expect <<'EOF'
+HEAD@{0}
+EOF
+test_expect_failure 'log.date does not invoke "--date" magic (format=%gd)' '
+ test_config log.date raw &&
+ git log -g -1 --format=%gd >actual &&
+ test_cmp expect actual
+'
+
: >expect
test_expect_success 'empty reflog file' '
git branch empty &&