]> git.ipfire.org Git - thirdparty/git.git/blame - t/t1413-reflog-detach.sh
help: make sure local html page exists before calling external processes
[thirdparty/git.git] / t / t1413-reflog-detach.sh
CommitLineData
014e7db3
JH
1#!/bin/sh
2
3test_description='Test reflog interaction with detached HEAD'
06d53148 4GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
334afbc7
JS
5export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
6
014e7db3
JH
7. ./test-lib.sh
8
9reset_state () {
1142746c 10 rm -rf .git && "$TAR" xf .git-saved.tar
014e7db3
JH
11}
12
13test_expect_success setup '
14 test_tick &&
15 git commit --allow-empty -m initial &&
16 git branch side &&
17 test_tick &&
18 git commit --allow-empty -m second &&
1142746c 19 "$TAR" cf .git-saved.tar .git
014e7db3
JH
20'
21
22test_expect_success baseline '
23 reset_state &&
06d53148 24 git rev-parse main main^ >expect &&
014e7db3
JH
25 git log -g --format=%H >actual &&
26 test_cmp expect actual
27'
28
29test_expect_success 'switch to branch' '
30 reset_state &&
06d53148 31 git rev-parse side main main^ >expect &&
014e7db3
JH
32 git checkout side &&
33 git log -g --format=%H >actual &&
34 test_cmp expect actual
35'
36
37test_expect_success 'detach to other' '
38 reset_state &&
06d53148 39 git rev-parse main side main main^ >expect &&
014e7db3 40 git checkout side &&
06d53148 41 git checkout main^0 &&
014e7db3
JH
42 git log -g --format=%H >actual &&
43 test_cmp expect actual
44'
45
46test_expect_success 'detach to self' '
47 reset_state &&
06d53148
JS
48 git rev-parse main main main^ >expect &&
49 git checkout main^0 &&
014e7db3
JH
50 git log -g --format=%H >actual &&
51 test_cmp expect actual
52'
53
54test_expect_success 'attach to self' '
55 reset_state &&
06d53148
JS
56 git rev-parse main main main main^ >expect &&
57 git checkout main^0 &&
58 git checkout main &&
014e7db3
JH
59 git log -g --format=%H >actual &&
60 test_cmp expect actual
61'
62
63test_expect_success 'attach to other' '
64 reset_state &&
06d53148
JS
65 git rev-parse side main main main^ >expect &&
66 git checkout main^0 &&
014e7db3
JH
67 git checkout side &&
68 git log -g --format=%H >actual &&
69 test_cmp expect actual
70'
71
72test_done