All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkout: don't check worktrees when not necessary
@ 2015-05-31 23:16 Spencer Baugh
  2015-06-01 10:23 ` Duy Nguyen
  0 siblings, 1 reply; 5+ messages in thread
From: Spencer Baugh @ 2015-05-31 23:16 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy, Spencer Baugh

When --patch or pathspecs are passed to git checkout, the working tree
will not be switching branch, so there's no need to check if the branch
that we are running checkout on is already checked out.

Signed-off-by: Spencer Baugh <sbaugh@catern.com>
---
 builtin/checkout.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/builtin/checkout.c b/builtin/checkout.c
index 2f92328..7039c5c 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1237,6 +1237,7 @@ static int parse_branchname_arg(int argc, const char **argv,
 		char *head_ref = resolve_refdup("HEAD", 0, sha1, &flag);
 		if (head_ref &&
 		    (!(flag & REF_ISSYMREF) || strcmp(head_ref, new->path)) &&
+		    !(opts->patch_mode || opts->pathspec.nr) &&
 		    !opts->ignore_other_worktrees)
 			check_linked_checkouts(new);
 		free(head_ref);
-- 
2.4.2.339.g77bd3ea

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-06-12 22:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-31 23:16 [PATCH] checkout: don't check worktrees when not necessary Spencer Baugh
2015-06-01 10:23 ` Duy Nguyen
2015-06-10 19:21   ` Spencer Baugh
2015-06-12 10:49     ` Nguyễn Thái Ngọc Duy
2015-06-12 22:24       ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.