From: Kevin Ballard Date: Tue, 30 Mar 2010 02:46:38 +0000 (-0700) Subject: format-patch: Squelch 'fatal: Not a range." error X-Git-Tag: v1.7.0.4~10 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=657ab61efa918f46f1b412613643d1a1bbed2194;p=git.git format-patch: Squelch 'fatal: Not a range." error Don't output an error on `git format-patch --ignore-if-in-upstream HEAD`. This matches the behavior of `git format-patch HEAD`. Signed-off-by: Kevin Ballard Signed-off-by: Junio C Hamano --- diff --git a/builtin-log.c b/builtin-log.c index e0d5caa61..76962e1b0 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -1106,8 +1106,15 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) return 0; } - if (ignore_if_in_upstream) + if (ignore_if_in_upstream) { + /* Don't say anything if head and upstream are the same. */ + if (rev.pending.nr == 2) { + struct object_array_entry *o = rev.pending.objects; + if (hashcmp(o[0].item->sha1, o[1].item->sha1) == 0) + return 0; + } get_patch_ids(&rev, &ids, prefix); + } if (!use_stdout) realstdout = xfdopen(xdup(1), "w"); diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index f2a2aaa2b..843ef7f88 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -557,4 +557,8 @@ test_expect_success 'format-patch -- ' ' ! grep "Use .--" error ' +test_expect_success 'format-patch --ignore-if-in-upstream HEAD' ' + git format-patch --ignore-if-in-upstream HEAD +' + test_done