checkout: add test demonstrating regression with checkout -b on initial commit
Commit fa655d8411 (checkout: optimize "git checkout -b <new_branch>", 2018-08-16) introduced an unintentional change in behavior for 'checkout -b' after doing 'clone --no-checkout'. Add a test to demonstrate the changed behavior to be used in a later patch to verify the fix. Signed-off-by: Ben Peart <benpeart@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ben Peart committed
Jan 23, 2019 at 15:02 UTC
91e3d7ca9b0194575c1fdbb82b74bef4eb8357a1
1 file changed
+9
t/t2018-checkout-branch.sh
+9
@@ -198,4 +198,13 @@ test_expect_success 'checkout -B to the current branch works' '
198
test_dirty_mergeable
199
'
200
201
+test_expect_failure 'checkout -b after clone --no-checkout does a checkout of HEAD' '
202
+ git init src &&
203
+ test_commit -C src a &&
204
+ rev="$(git -C src rev-parse HEAD)" &&
205
+ git clone --no-checkout src dest &&
206
+ git -C dest checkout "$rev" -b branch &&
207
+ test_path_is_file dest/a.t
208
+'
209
+
210
test_done