From 382da4023f155eabdda58ebd595a1e142408a56d Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Thu, 26 Nov 2009 21:11:59 +0200 Subject: format-patch: fix parsing of "--" on the command line When given a pathspec that does not match any path in the current work tree with an explicit "--": git format-patch -- the command still complains that does not exist in the current work tree and the user needs to explicitly specify "--" and errors out. This is because it incorrectly removes "--" from the command line arguments that is later passed to setup_revisions(). Signed-off-by: Felipe Contreras Signed-off-by: Junio C Hamano --- builtin-log.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin-log.c b/builtin-log.c index 25e21ed415..cac98afddb 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -966,7 +966,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) */ argc = parse_options(argc, argv, prefix, builtin_format_patch_options, builtin_format_patch_usage, - PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN); + PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN | + PARSE_OPT_KEEP_DASHDASH); if (do_signoff) { const char *committer; -- cgit v1.2.3 From 7e93d3b9e58a359a1073460e8f2cb3fef0368bd7 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Thu, 26 Nov 2009 21:12:00 +0200 Subject: format-patch: add test for parsing of "--" Signed-off-by: Felipe Contreras Signed-off-by: Junio C Hamano --- t/t4014-format-patch.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index 531f5b795c..437807e41e 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -515,4 +515,9 @@ test_expect_success 'format-patch --signoff' ' grep "^Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" ' +test_expect_success 'format-patch -- ' ' + git format-patch master..side -- file 2>error && + ! grep "Use .--" error +' + test_done -- cgit v1.2.3