git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Spencer Baugh <sbaugh@catern.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Spencer Baugh" <sbaugh@catern.com>
Subject: [PATCH] checkout: don't check worktrees when not necessary
Date: Sun, 31 May 2015 19:16:29 -0400	[thread overview]
Message-ID: <1433114189-9779-1-git-send-email-sbaugh@catern.com> (raw)

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

             reply	other threads:[~2015-05-31 23:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-31 23:16 Spencer Baugh [this message]
2015-06-01 10:23 ` [PATCH] checkout: don't check worktrees when not necessary 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433114189-9779-1-git-send-email-sbaugh@catern.com \
    --to=sbaugh@catern.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).