Skip to content

Commit

Permalink
git-checkout: fix command line parsing.
Browse files Browse the repository at this point in the history
This fixes an issue when you use:

    $ git checkout -- <path1> [<paths>...]

and that <path1> can also be understood as a reference. git-checkout
mistakenly understands this as the same as:

    $ git checkout <path1> -- [<paths>...]

because parse-options was eating the '--' and the argument parser thought
he was parsing:

    $ git checkout <path1> [<paths>...]

Where there indeed is an ambiguity

Signed-off-by: Pierre Habouzit <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
MadCoder authored and gitster committed Jul 23, 2008
1 parent 2d9c572 commit f5242eb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builtin-checkout.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,8 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)

opts.track = git_branch_track;

argc = parse_options(argc, argv, options, checkout_usage, 0);
argc = parse_options(argc, argv, options, checkout_usage,
PARSE_OPT_KEEP_DASHDASH);
if (argc) {
arg = argv[0];
if (get_sha1(arg, rev))
Expand Down

0 comments on commit f5242eb

Please sign in to comment.