]> git.ipfire.org Git - thirdparty/git.git/blame - t/t1411-reflog-show.sh
test-lib: refactor $GIT_SKIP_TESTS matching
[thirdparty/git.git] / t / t1411-reflog-show.sh
CommitLineData
cd437120
JK
1#!/bin/sh
2
3test_description='Test reflog display routines'
4. ./test-lib.sh
5
6test_expect_success 'setup' '
7 echo content >file &&
8 git add file &&
9 test_tick &&
10 git commit -m one
11'
12
13cat >expect <<'EOF'
14Reflog: HEAD@{0} (C O Mitter <committer@example.com>)
15Reflog message: commit (initial): one
16EOF
17test_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
23cat >expect <<'EOF'
24e46513e HEAD@{0}: commit (initial): one
25EOF
26test_expect_success 'oneline reflog format' '
27 git log -g -1 --oneline >actual &&
28 test_cmp expect actual
29'
30
21d2616a
MG
31test_expect_success 'reflog default format' '
32 git reflog -1 >actual &&
33 test_cmp expect actual
34'
35
36cat >expect <<'EOF'
37commit e46513e
38Reflog: HEAD@{0} (C O Mitter <committer@example.com>)
39Reflog message: commit (initial): one
40Author: A U Thor <author@example.com>
41
42 one
43EOF
4b56cf58 44test_expect_success 'override reflog default format' '
21d2616a
MG
45 git reflog --format=short -1 >actual &&
46 test_cmp expect actual
47'
48
cd437120
JK
49cat >expect <<'EOF'
50Reflog: HEAD@{Thu Apr 7 15:13:13 2005 -0700} (C O Mitter <committer@example.com>)
51Reflog message: commit (initial): one
52EOF
53test_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
59cat >expect <<'EOF'
60e46513e HEAD@{Thu Apr 7 15:13:13 2005 -0700}: commit (initial): one
61EOF
62test_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
7904af1c
JK
67cat >expect <<'EOF'
68HEAD@{Thu Apr 7 15:13:13 2005 -0700}
69EOF
70test_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
cd437120 75cat >expect <<'EOF'
55ccf85a 76Reflog: HEAD@{Thu Apr 7 15:13:13 2005 -0700} (C O Mitter <committer@example.com>)
cd437120
JK
77Reflog message: commit (initial): one
78EOF
79test_expect_success 'using --date= shows reflog date (multiline)' '
55ccf85a 80 git log -g -1 --date=default >tmp &&
cd437120
JK
81 grep ^Reflog <tmp >actual &&
82 test_cmp expect actual
83'
84
85cat >expect <<'EOF'
55ccf85a 86e46513e HEAD@{Thu Apr 7 15:13:13 2005 -0700}: commit (initial): one
cd437120
JK
87EOF
88test_expect_success 'using --date= shows reflog date (oneline)' '
55ccf85a 89 git log -g -1 --oneline --date=default >actual &&
cd437120
JK
90 test_cmp expect actual
91'
92
7904af1c
JK
93cat >expect <<'EOF'
94HEAD@{1112911993 -0700}
95EOF
96test_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
101cat >expect <<'EOF'
102Reflog: HEAD@{0} (C O Mitter <committer@example.com>)
103Reflog message: commit (initial): one
104EOF
105test_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
112cat >expect <<'EOF'
113e46513e HEAD@{0}: commit (initial): one
114EOF
115test_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
121cat >expect <<'EOF'
122HEAD@{0}
123EOF
f026c756 124test_expect_success 'log.date does not invoke "--date" magic (format=%gd)' '
7904af1c
JK
125 test_config log.date raw &&
126 git log -g -1 --format=%gd >actual &&
127 test_cmp expect actual
128'
129
794151e9
JK
130cat >expect <<'EOF'
131HEAD@{0}
132EOF
133test_expect_success '--date magic does not override explicit @{0} syntax' '
134 git log -g -1 --format=%gd --date=raw HEAD@{0} >actual &&
135 test_cmp expect actual
136'
137
8fcaca3f
DO
138: >expect
139test_expect_success 'empty reflog file' '
140 git branch empty &&
141 : >.git/logs/refs/heads/empty &&
142
143 git log -g empty >actual &&
144 test_cmp expect actual
145'
146
cd437120 147test_done