]>
Commit | Line | Data |
---|---|---|
cd437120 JK |
1 | #!/bin/sh |
2 | ||
3 | test_description='Test reflog display routines' | |
4 | . ./test-lib.sh | |
5 | ||
6 | test_expect_success 'setup' ' | |
7 | echo content >file && | |
8 | git add file && | |
9 | test_tick && | |
10 | git commit -m one | |
11 | ' | |
12 | ||
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 | |
21 | ' | |
22 | ||
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 | |
29 | ' | |
30 | ||
21d2616a MG |
31 | test_expect_success 'reflog default format' ' |
32 | git reflog -1 >actual && | |
33 | test_cmp expect actual | |
34 | ' | |
35 | ||
36 | cat >expect <<'EOF' | |
37 | commit e46513e | |
38 | Reflog: HEAD@{0} (C O Mitter <committer@example.com>) | |
39 | Reflog message: commit (initial): one | |
40 | Author: A U Thor <author@example.com> | |
41 | ||
42 | one | |
43 | EOF | |
4b56cf58 | 44 | test_expect_success 'override reflog default format' ' |
21d2616a MG |
45 | git reflog --format=short -1 >actual && |
46 | test_cmp expect actual | |
47 | ' | |
48 | ||
cd437120 JK |
49 | cat >expect <<'EOF' |
50 | Reflog: HEAD@{Thu Apr 7 15:13:13 2005 -0700} (C O Mitter <committer@example.com>) | |
51 | Reflog message: commit (initial): one | |
52 | EOF | |
53 | test_expect_success 'using @{now} syntax shows reflog date (multiline)' ' | |
54 | git log -g -1 HEAD@{now} >tmp && | |
55 | grep ^Reflog <tmp >actual && | |
56 | test_cmp expect actual | |
57 | ' | |
58 | ||
59 | cat >expect <<'EOF' | |
60 | e46513e HEAD@{Thu Apr 7 15:13:13 2005 -0700}: commit (initial): one | |
61 | EOF | |
62 | test_expect_success 'using @{now} syntax shows reflog date (oneline)' ' | |
63 | git log -g -1 --oneline HEAD@{now} >actual && | |
64 | test_cmp expect actual | |
65 | ' | |
66 | ||
67 | cat >expect <<'EOF' | |
68 | Reflog: HEAD@{1112911993 -0700} (C O Mitter <committer@example.com>) | |
69 | Reflog message: commit (initial): one | |
70 | EOF | |
71 | test_expect_success 'using --date= shows reflog date (multiline)' ' | |
72 | git log -g -1 --date=raw >tmp && | |
73 | grep ^Reflog <tmp >actual && | |
74 | test_cmp expect actual | |
75 | ' | |
76 | ||
77 | cat >expect <<'EOF' | |
78 | e46513e HEAD@{1112911993 -0700}: commit (initial): one | |
79 | EOF | |
80 | test_expect_success 'using --date= shows reflog date (oneline)' ' | |
81 | git log -g -1 --oneline --date=raw >actual && | |
82 | test_cmp expect actual | |
83 | ' | |
84 | ||
8fcaca3f DO |
85 | : >expect |
86 | test_expect_success 'empty reflog file' ' | |
87 | git branch empty && | |
88 | : >.git/logs/refs/heads/empty && | |
89 | ||
90 | git log -g empty >actual && | |
91 | test_cmp expect actual | |
92 | ' | |
93 | ||
cd437120 | 94 | test_done |