Skip to content

Commit

Permalink
t1401,t2011: parameterize HEAD.lock for REFFILES
Browse files Browse the repository at this point in the history
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
  • Loading branch information
hanwen committed Aug 17, 2021
1 parent a44956d commit f0b7b1e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions t/t1401-symbolic-ref.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,16 @@ test_expect_success LONG_REF 'we can parse long symbolic ref' '
test_cmp expect actual
'

if test_have_prereq REFFILES
then
HEAD_LOCK=HEAD.lock
else
HEAD_LOCK=reftable/tables.list.lock
fi

test_expect_success 'symbolic-ref reports failure in exit code' '
test_when_finished "rm -f .git/HEAD.lock" &&
>.git/HEAD.lock &&
test_when_finished "rm -f .git/$HEAD_LOCK" &&
>.git/$HEAD_LOCK &&
test_must_fail git symbolic-ref HEAD refs/heads/whatever
'

Expand Down
11 changes: 9 additions & 2 deletions t/t2011-checkout-invalid-head.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ test_expect_success 'checkout main from invalid HEAD' '
git checkout main --
'

if test_have_prereq REFFILES
then
HEAD_LOCK=HEAD.lock
else
HEAD_LOCK=reftable/tables.list.lock
fi

test_expect_success 'checkout notices failure to lock HEAD' '
test_when_finished "rm -f .git/HEAD.lock" &&
>.git/HEAD.lock &&
test_when_finished "rm -f .git/$HEAD_LOCK" &&
>.git/$HEAD_LOCK &&
test_must_fail git checkout -b other
'

Expand Down

0 comments on commit f0b7b1e

Please sign in to comment.