"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@xxxxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html