diff mbox series

[v2,1/2] checkout: add test to demonstrate regression with checkout -b on initial commit

Message ID 20190121195008.8700-2-peartben@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/2] checkout: add test to demonstrate regression with checkout -b on initial commit | expand

Commit Message

Ben Peart Jan. 21, 2019, 7:50 p.m. UTC
From: Ben Peart <benpeart@microsoft.com>

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>
---
 t/t2018-checkout-branch.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

SZEDER Gábor Jan. 23, 2019, 5:57 p.m. UTC | #1
On Mon, Jan 21, 2019 at 02:50:07PM -0500, Ben Peart wrote:
> From: Ben Peart <benpeart@microsoft.com>
> 
> 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.

Please wrap the commit message at a width of around 70 or so
characters.  The commit messages of both patches contain lines that
are wider than a standard 80 char wide terminal.
diff mbox series

Patch

diff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh
index 2131fb2a56..6da2d4e68f 100755
--- a/t/t2018-checkout-branch.sh
+++ b/t/t2018-checkout-branch.sh
@@ -198,4 +198,13 @@  test_expect_success 'checkout -B to the current branch works' '
 	test_dirty_mergeable
 '
 
+test_expect_failure 'checkout -b after clone --no-checkout does a checkout of HEAD' '
+	git init src &&
+	test_commit -C src a &&
+	rev="$(git -C src rev-parse HEAD)" &&
+	git clone --no-checkout src dest &&
+	git -C dest checkout "$rev" -b branch &&
+	test_path_is_file dest/a.t
+'
+
 test_done