@matheusbsbs / matheus-bagliano / commits / f5242ebf0d
Fork 0

git-checkout: fix command line parsing.

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 <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Pierre Habouzit committed Jul 23, 2008 at 12:15 UTC f5242ebf0dcd858ae9c72f39aed9773696d7283d
1 file changed +2 -1
builtin-checkout.c
+2 -1
@@ -520,7 +520,8 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
520
521 opts.track = git_branch_track;
522
523 - argc = parse_options(argc, argv, options, checkout_usage, 0);
523 + argc = parse_options(argc, argv, options, checkout_usage,
524 + PARSE_OPT_KEEP_DASHDASH);
525 if (argc) {
526 arg = argv[0];
527 if (get_sha1(arg, rev))