06d531486e
Carefully excluding t1309, which sees independent development elsewhere at the time of writing, we transition above-mentioned tests to the default branch name `main`. This trick was performed via $ (cd t && sed -i -e 's/master/main/g' -e 's/MASTER/MAIN/g' \ -e 's/Master/Main/g' -e 's/naster/nain/g' -- t[01]*.sh && git checkout HEAD -- t1309\*) Note that t5533 contains a variation of the name `master` (`naster`) that we rename here, too. This allows us to define `GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main` for those tests. Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
74 lines
1.6 KiB
Bash
Executable File
74 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='Test reflog interaction with detached HEAD'
|
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
|
|
|
. ./test-lib.sh
|
|
|
|
reset_state () {
|
|
git checkout main &&
|
|
cp saved_reflog .git/logs/HEAD
|
|
}
|
|
|
|
test_expect_success setup '
|
|
test_tick &&
|
|
git commit --allow-empty -m initial &&
|
|
git branch side &&
|
|
test_tick &&
|
|
git commit --allow-empty -m second &&
|
|
cat .git/logs/HEAD >saved_reflog
|
|
'
|
|
|
|
test_expect_success baseline '
|
|
reset_state &&
|
|
git rev-parse main main^ >expect &&
|
|
git log -g --format=%H >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'switch to branch' '
|
|
reset_state &&
|
|
git rev-parse side main main^ >expect &&
|
|
git checkout side &&
|
|
git log -g --format=%H >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'detach to other' '
|
|
reset_state &&
|
|
git rev-parse main side main main^ >expect &&
|
|
git checkout side &&
|
|
git checkout main^0 &&
|
|
git log -g --format=%H >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'detach to self' '
|
|
reset_state &&
|
|
git rev-parse main main main^ >expect &&
|
|
git checkout main^0 &&
|
|
git log -g --format=%H >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'attach to self' '
|
|
reset_state &&
|
|
git rev-parse main main main main^ >expect &&
|
|
git checkout main^0 &&
|
|
git checkout main &&
|
|
git log -g --format=%H >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_expect_success 'attach to other' '
|
|
reset_state &&
|
|
git rev-parse side main main main^ >expect &&
|
|
git checkout main^0 &&
|
|
git checkout side &&
|
|
git log -g --format=%H >actual &&
|
|
test_cmp expect actual
|
|
'
|
|
|
|
test_done
|