Re: [PATCH v4 0/5] Kill manual ref parsing code in worktree.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 13, 2017 at 07:02:22PM -0700, Junio C Hamano wrote:
> Oops, I shouldn't have done that.  When applied on top of the
> files-backend thing (or have you updated that one and is my tree
> lacking it???), this breaks quite a few tests.
> 
> t0001#41 dumps core from "git worktree add ../linked-worktree" for
> example.

This is embarassing. I worked on and off on this series over a long
period of time. I guess at the end I thought everything was ok "since
the last time" and just sent it away without realizing I hadn't
actually run the test suite, because it does fail here, now.

This fixup patch should make the test suite pass. I'm sorry for
wasting your time on this.

-- 8< --
>From 09c6d432490b8e9de99eca09cdbdaebf53bbad2c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?=
 <pclouds@xxxxxxxxx>
Date: Fri, 14 Apr 2017 19:39:53 +0700
Subject: [PATCH] fixup! refs: introduce get_worktree_ref_store()

---
 refs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/refs.c b/refs.c
index a4083caf6a..05045a64e1 100644
--- a/refs.c
+++ b/refs.c
@@ -1600,11 +1600,13 @@ struct ref_store *get_worktree_ref_store(const struct worktree *wt)
 	unsigned int refs_all_capabilities =
 		REF_STORE_READ | REF_STORE_WRITE |
 		REF_STORE_ODB | REF_STORE_MAIN;
+	const char *id;
 
 	if (wt->is_current)
 		return get_main_ref_store();
 
-	refs = lookup_ref_store_map(&worktree_ref_stores, wt->id);
+	id = wt->id ? wt->id : "/";
+	refs = lookup_ref_store_map(&worktree_ref_stores, id);
 	if (refs)
 		return refs;
 
@@ -1617,7 +1619,7 @@ struct ref_store *get_worktree_ref_store(const struct worktree *wt)
 
 	if (refs)
 		register_ref_store_map(&worktree_ref_stores, "worktree",
-				       refs, wt->id);
+				       refs, id);
 	return refs;
 }
 
-- 
2.11.0.157.gd943d85

-- 8< --



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]