From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: pclouds@gmail.com
Subject: [PATCH 8/9] checkout ":" is not giving any pathspec
Date: Mon, 9 May 2011 22:51:17 -0700 [thread overview]
Message-ID: <1305006678-4051-9-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1305006678-4051-1-git-send-email-gitster@pobox.com>
"git cmd :" should be exactly the same as running "git cmd" from the
root level of the working tree. Do not decide solely on the value of
argc (i.e. remaining parameters after options and revs are parsed),
but make sure we actually do have pathspec to switch operation modes.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin/checkout.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 2bf02f2..fe46725 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -890,6 +890,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
char *conflict_style = NULL;
int patch_mode = 0;
int dwim_new_local_branch = 1;
+ const char **pathspec;
struct option options[] = {
OPT__QUIET(&opts.quiet, "suppress progress reporting"),
OPT_STRING('b', NULL, &opts.new_branch, "branch",
@@ -1004,12 +1005,8 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
if (opts.track == BRANCH_TRACK_UNSPECIFIED)
opts.track = git_branch_track;
- if (argc) {
- const char **pathspec = get_pathspec(prefix, argv);
-
- if (!pathspec)
- die("invalid path specification");
-
+ pathspec = get_pathspec(prefix, argv);
+ if (argc && pathspec) {
if (patch_mode)
return interactive_checkout(new.name, pathspec, &opts);
--
1.7.5.1.290.g1b565
next prev parent reply other threads:[~2011-05-10 5:51 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-07 10:35 [PATCH] t3703: add test cases for pathspec magic Nguyễn Thái Ngọc Duy
2011-05-07 18:56 ` Junio C Hamano
2011-05-08 9:59 ` Nguyen Thai Ngoc Duy
2011-05-08 11:08 ` [PATCH] t3703, t4208: add test cases for magic pathspec Nguyễn Thái Ngọc Duy
2011-05-08 17:59 ` Junio C Hamano
2011-05-09 12:33 ` Nguyen Thai Ngoc Duy
2011-05-09 16:18 ` Junio C Hamano
2011-05-09 22:06 ` Junio C Hamano
2011-05-10 5:51 ` [PATCH 0/9] magic pathspec updates Junio C Hamano
2011-05-10 5:51 ` [PATCH 1/9] grep: use get_pathspec() correctly Junio C Hamano
2011-05-10 5:51 ` [PATCH 2/9] get_pathspec(): an empty ':' pathspec should stand alone Junio C Hamano
2011-05-10 5:51 ` [PATCH 3/9] count_pathspec(): return number of elements in pathspec Junio C Hamano
2011-05-10 13:29 ` Nguyen Thai Ngoc Duy
2011-05-10 5:51 ` [PATCH 4/9] add ":" is a pathspec that is too wide Junio C Hamano
2011-05-10 5:51 ` [PATCH 5/9] git rm ":" is like specifying nothing Junio C Hamano
2011-05-10 5:51 ` [PATCH 6/9] clean " Junio C Hamano
2011-05-10 15:14 ` Thiago Farina
2011-05-10 5:51 ` [PATCH 7/9] mv ":" ":" is like moving nothing from nowhere to nowhere Junio C Hamano
2011-05-10 13:30 ` Nguyen Thai Ngoc Duy
2011-05-10 5:51 ` Junio C Hamano [this message]
2011-05-10 5:51 ` [PATCH 9/9] t3703, t4208: add test cases for magic pathspec Junio C Hamano
2011-05-12 8:21 ` [PATCH jc/magic-pathspec] t3703: Skip tests using directory name ":" on Windows Johannes Sixt
2011-05-29 18:29 ` [PATCH 9/9] t3703, t4208: add test cases for magic pathspec Ævar Arnfjörð Bjarmason
2011-05-29 20:31 ` Junio C Hamano
2011-05-29 20:36 ` Ævar Arnfjörð Bjarmason
2011-05-10 13:47 ` [PATCH 0/9] magic pathspec updates Nguyen Thai Ngoc Duy
2011-05-10 17:07 ` Junio C Hamano
2011-05-11 12:11 ` Nguyen Thai Ngoc Duy
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=1305006678-4051-9-git-send-email-gitster@pobox.com \
--to=gitster@pobox.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).