Subject: [PATCH 2/2] reachable: Add HEADs of all worktrees to reachability analysis

From: [email-masked]
Date: Tue, 16 May 2017 17:50:41 -0700

From: Manish Goregaokar <[email-masked]>

* reachable.c:
  mark_reachable_objects: Include other worktrees

Signed-off-by: Manish Goregaokar <[email-masked]>
---
 reachable.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/reachable.c b/reachable.c
index d0199ca..439708e 100644
--- a/reachable.c
+++ b/reachable.c
@@ -178,6 +178,9 @@ void mark_reachable_objects(struct rev_info *revs, int mark_reflog,
 	/* detached HEAD is not included in the list above */
 	head_ref(add_one_ref, revs);
 
+	/* worktrees are not included in either */
+	for_each_worktree_ref(add_one_ref, revs);
+
 	/* Add all reflog info */
 	if (mark_reflog)
 		add_reflogs_to_pending(revs, 0);
-- 
2.10.1