From: Kevin Ballard <kevin@sb.org>
To: git@vger.kernel.org
Cc: Kevin Ballard <kevin@sb.org>, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] format-patch: Squelch 'fatal: Not a range." error
Date: Mon, 29 Mar 2010 19:46:38 -0700 [thread overview]
Message-ID: <1269917198-58320-1-git-send-email-kevin@sb.org> (raw)
In-Reply-To: <46BEF37C-3E3F-4490-9CE6-C0109438C181@sb.org>
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 <kevin@sb.org>
---
This seems like a safer change than just deleting the die("Not a range.").
The conditional here is copied from cmd_cherry().
builtin/log.c | 9 ++++++++-
t/t4014-format-patch.sh | 4 ++++
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/builtin/log.c b/builtin/log.c
index 0cb4d5a..362dd42 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1179,8 +1179,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 c7b6256..d21c37f 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -609,4 +609,8 @@ test_expect_success 'format-patch -- <path>' '
! grep "Use .--" error
'
+test_expect_success 'format-patch --ignore-if-in-upstream HEAD' '
+ git format-patch --ignore-if-in-upstream HEAD
+'
+
test_done
--
1.7.0.3.436.g3ff98
prev parent reply other threads:[~2010-03-30 2:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-24 0:03 [PATCH] rebase: Squelch the "fatal: Not an error." message Kevin Ballard
2010-03-25 21:24 ` Kevin Ballard
2010-03-26 19:25 ` Junio C Hamano
2010-03-26 23:31 ` Kevin Ballard
2010-03-27 0:08 ` Kevin Ballard
2010-03-30 2:46 ` Kevin Ballard [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1269917198-58320-1-git-send-email-kevin@sb.org \
--to=kevin@sb.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).