Skip to content

Fix regression in checkout -b

Ben Peart git 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 1 replyIn review
  2. v22 patches 7 repliesSuperseded
  3. v12 patches 4 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2checkout: add test demonstrating regression with checkout -b on initial committ/t2018-checkout-branch.sh+9 -00 replies
2/2checkout: fix regression in checkout -b on intitial checkoutbuiltin/checkout.c t/t2018-checkout-branch.sh+9 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/2] Fix regression in checkout -b

From: Ben Peart <[email protected]>

Minor update to comment from V2. Also wrapped commit messages to be <80 chars wide.

Base Ref: master
Web-Diff: https://github.com/benpeart/git/commit/fef76edbdc
Checkout: git fetch https://github.com/benpeart/git initial-checkout-v3 && git checkout fef76edbdc

### Interdiff (v2..v3):

builtin/checkout.c +3 -2
index 9c6e94319e..9f8f3466f6 100644
@@ -593,8 +593,9 @@ static int skip_merge_working_tree(const struct checkout_opts *opts,
 	 */
 
 	 /*
-	  * Do the merge if this is the initial checkout
-	  *
+	  * Do the merge if this is the initial checkout. We cannot use
+	  * is_cache_unborn() here because the index hasn't been loaded yet
+	  * so cache_nr and timestamp.sec are always zero.
 	  */
 	if (!file_exists(get_index_file()))
 		return 0;

### Patches

Ben Peart (2):
checkout: add test demonstrating regression with checkout -b on
initial commit
checkout: fix regression in checkout -b on intitial checkout

 builtin/checkout.c         | 8 ++++++++
 t/t2018-checkout-branch.sh | 9 +++++++++
 2 files changed, 17 insertions(+)

base-commit: 77556354bb7ac50450e3b28999e3576969869068

Signature · 1 line
2.19.1.gvfs.1.16.g9d1374d