Merge branch 'mm/phrase-remote-tracking'
[git/kirr.git] / t / t1411-reflog-show.sh
blobba25ff354d6fc4998237b1145737faf6c836966e
1 #!/bin/sh
3 test_description='Test reflog display routines'
4 . ./test-lib.sh
6 test_expect_success 'setup' '
7 echo content >file &&
8 git add file &&
9 test_tick &&
10 git commit -m one
13 cat >expect <<'EOF'
14 Reflog: HEAD@{0} (C O Mitter <committer@example.com>)
15 Reflog message: commit (initial): one
16 EOF
17 test_expect_success 'log -g shows reflog headers' '
18 git log -g -1 >tmp &&
19 grep ^Reflog <tmp >actual &&
20 test_cmp expect actual
23 cat >expect <<'EOF'
24 e46513e HEAD@{0}: commit (initial): one
25 EOF
26 test_expect_success 'oneline reflog format' '
27 git log -g -1 --oneline >actual &&
28 test_cmp expect actual
31 cat >expect <<'EOF'
32 Reflog: HEAD@{Thu Apr 7 15:13:13 2005 -0700} (C O Mitter <committer@example.com>)
33 Reflog message: commit (initial): one
34 EOF
35 test_expect_success 'using @{now} syntax shows reflog date (multiline)' '
36 git log -g -1 HEAD@{now} >tmp &&
37 grep ^Reflog <tmp >actual &&
38 test_cmp expect actual
41 cat >expect <<'EOF'
42 e46513e HEAD@{Thu Apr 7 15:13:13 2005 -0700}: commit (initial): one
43 EOF
44 test_expect_success 'using @{now} syntax shows reflog date (oneline)' '
45 git log -g -1 --oneline HEAD@{now} >actual &&
46 test_cmp expect actual
49 cat >expect <<'EOF'
50 Reflog: HEAD@{1112911993 -0700} (C O Mitter <committer@example.com>)
51 Reflog message: commit (initial): one
52 EOF
53 test_expect_success 'using --date= shows reflog date (multiline)' '
54 git log -g -1 --date=raw >tmp &&
55 grep ^Reflog <tmp >actual &&
56 test_cmp expect actual
59 cat >expect <<'EOF'
60 e46513e HEAD@{1112911993 -0700}: commit (initial): one
61 EOF
62 test_expect_success 'using --date= shows reflog date (oneline)' '
63 git log -g -1 --oneline --date=raw >actual &&
64 test_cmp expect actual
67 : >expect
68 test_expect_success 'empty reflog file' '
69 git branch empty &&
70 : >.git/logs/refs/heads/empty &&
72 git log -g empty >actual &&
73 test_cmp expect actual
76 test_done