From: Dirk Wallenstein <halsmit@t-online.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Shawn O. Pearce" <spearce@spearce.org>
Subject: [PATCH v2] request-pull: improve error message for invalid revision args
Date: Wed, 17 Jul 2013 19:28:11 +0200 [thread overview]
Message-ID: <20130717172811.GA12981@bottich> (raw)
In-Reply-To: <7vr4ex6rqq.fsf@alter.siamese.dyndns.org>
Currently, when an invalid revision is specified, the error message is:
fatal: Needed a single revision
This is misleading because, you might think there is something wrong
with the command line as a whole.
Now the user gets a more meaningful error message, showing the invalid
revision.
Signed-off-by: Dirk Wallenstein <halsmit@t-online.de>
---
On Wed, Jul 17, 2013 at 10:06:21AM -0700, Junio C Hamano wrote:
> Dirk Wallenstein <halsmit@t-online.de> writes:
> > +baserev=$(git rev-parse --verify "$base"^0 2>/dev/null)
>
> Use "--quiet" instead?
Oh, of course.
git-request-pull.sh | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/git-request-pull.sh b/git-request-pull.sh
index d566015..ebf1269 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -51,8 +51,18 @@ fi
tag_name=$(git describe --exact "$head^0" 2>/dev/null)
test -n "$base" && test -n "$url" || usage
-baserev=$(git rev-parse --verify "$base"^0) &&
-headrev=$(git rev-parse --verify "$head"^0) || exit
+
+baserev=$(git rev-parse --verify --quiet "$base"^0)
+if test -z "$baserev"
+then
+ die "fatal: Not a valid revision: $base"
+fi
+
+headrev=$(git rev-parse --verify --quiet "$head"^0)
+if test -z "$headrev"
+then
+ die "fatal: Not a valid revision: $head"
+fi
merge_base=$(git merge-base $baserev $headrev) ||
die "fatal: No commits in common between $base and $head"
--
1.8.3.3.2.g85103ba
prev parent reply other threads:[~2013-07-17 17:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-16 10:46 [PATCH] request-pull: improve error message for invalid revision args Dirk Wallenstein
2013-07-17 17:06 ` Junio C Hamano
2013-07-17 17:28 ` Dirk Wallenstein [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=20130717172811.GA12981@bottich \
--to=halsmit@t-online.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=spearce@spearce.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.