From 6d5b93f29f5362b9b84954d87684705227984f9e Mon Sep 17 00:00:00 2001 From: Clemens Buchacher Date: Sat, 14 Apr 2012 21:04:48 +0200 Subject: cherry-pick: do not expect file arguments If a commit-ish passed to cherry-pick or revert happens to have a file of the same name, git complains that the argument is ambiguous and advises to use '--'. To make things worse, the '--' argument is removed by parse_options, und so passing '--' has no effect. Instead, always interpret cherry-pick/revert arguments as revisions. Signed-off-by: Clemens Buchacher Signed-off-by: Junio C Hamano --- builtin/revert.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'builtin/revert.c') diff --git a/builtin/revert.c b/builtin/revert.c index e6840f23dc..92f3fa5f57 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -181,12 +181,15 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts) if (opts->subcommand != REPLAY_NONE) { opts->revs = NULL; } else { + struct setup_revision_opt s_r_opt; opts->revs = xmalloc(sizeof(*opts->revs)); init_revisions(opts->revs, NULL); opts->revs->no_walk = 1; if (argc < 2) usage_with_options(usage_str, options); - argc = setup_revisions(argc, argv, opts->revs, NULL); + memset(&s_r_opt, 0, sizeof(s_r_opt)); + s_r_opt.assume_dashdash = 1; + argc = setup_revisions(argc, argv, opts->revs, &s_r_opt); } if (argc > 1) -- cgit v1.2.3