Re: [PATCH v21 0/19] rs/ref-transaction (Re: Transaction patch series overview)
From: Junio C Hamano <hidden>
Date: 2016-06-15 23:02:30
Junio C Hamano [off-list ref] writes:
I noticed that with this series merged to the version I use daily, detaching HEAD (i.e. "git checkout HEAD^0") breaks my HEAD reflog, which made me redo the integration ejecting the series out of 'pu'. Not happy, as my workflow relies fairly heavily on detached HEAD X-<.
Just FYI.
Bisecting the series using the attached as a test script points
"branch -d: avoid repeated symref resolution" as a possible culprit.
Perhaps these tests may want to be added to t3200 which is touched
by the said commit (or add them earlier in the series)?
-- >8 --
#!/bin/sh
test_description='reflog not nuked with co HEAD^0'
. ./test-lib.sh
check_reflog () {
while read name
do
git rev-parse --verify "$name"
done >expect &&
if test -f "$2"
then
while read object rest
do
git rev-parse --verify "$object"
done >>expect <"$2"
fi &&
while read object rest
do
git rev-parse --verify "$object"
done >actual <"$1" &&
test_cmp expect actual
}
test_expect_success setup '
test_tick &&
git commit --allow-empty -m initial &&
git branch side &&
test_tick &&
git commit --allow-empty -m second &&
git log -g --oneline >baseline &&
check_reflog baseline <<-\EOF
master
master^
EOF
'
test_expect_success 'switch to branch' '
git checkout side &&
git log -g --oneline >switched &&
check_reflog switched baseline <<-\EOF
side
EOF
'
test_expect_success 'detach to other' '
git checkout master^0 &&
git log -g --oneline >detach-1 &&
check_reflog detach-1 switched <<-\EOF
master
EOF
'
test_expect_success 'attach to self' '
git checkout master &&
git log -g --oneline >detach-2 &&
check_reflog detach-2 detach-1 <<-\EOF
master
EOF
'
test_expect_success 'detach to self' '
git checkout master^0 &&
git log -g --oneline >detach-3 &&
check_reflog detach-3 detach-2 <<-\EOF
master
EOF
'
test_expect_success 'attach to other' '
git checkout HEAD^0 &&
git checkout side &&
git log -g --oneline >detach-4 &&
check_reflog detach-4 detach-3 <<-\EOF
side
EOF
'
test_done