Merge branch 'master' of git://github.com/git-l10n/git-po
[git/raj.git] / t / t1413-reflog-detach.sh
blobc730600d8a78c537e52bdf6acc9798a6809b6295
1 #!/bin/sh
3 test_description='Test reflog interaction with detached HEAD'
4 . ./test-lib.sh
6 reset_state () {
7 git checkout master &&
8 cp saved_reflog .git/logs/HEAD
11 test_expect_success setup '
12 test_tick &&
13 git commit --allow-empty -m initial &&
14 git branch side &&
15 test_tick &&
16 git commit --allow-empty -m second &&
17 cat .git/logs/HEAD >saved_reflog
20 test_expect_success baseline '
21 reset_state &&
22 git rev-parse master master^ >expect &&
23 git log -g --format=%H >actual &&
24 test_cmp expect actual
27 test_expect_success 'switch to branch' '
28 reset_state &&
29 git rev-parse side master master^ >expect &&
30 git checkout side &&
31 git log -g --format=%H >actual &&
32 test_cmp expect actual
35 test_expect_success 'detach to other' '
36 reset_state &&
37 git rev-parse master side master master^ >expect &&
38 git checkout side &&
39 git checkout master^0 &&
40 git log -g --format=%H >actual &&
41 test_cmp expect actual
44 test_expect_success 'detach to self' '
45 reset_state &&
46 git rev-parse master master master^ >expect &&
47 git checkout master^0 &&
48 git log -g --format=%H >actual &&
49 test_cmp expect actual
52 test_expect_success 'attach to self' '
53 reset_state &&
54 git rev-parse master master master master^ >expect &&
55 git checkout master^0 &&
56 git checkout master &&
57 git log -g --format=%H >actual &&
58 test_cmp expect actual
61 test_expect_success 'attach to other' '
62 reset_state &&
63 git rev-parse side master master master^ >expect &&
64 git checkout master^0 &&
65 git checkout side &&
66 git log -g --format=%H >actual &&
67 test_cmp expect actual
70 test_done