request-pull: improve error message for invalid revision args
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Dirk Wallenstein committed
Jul 17, 2013 at 19:28 UTC
ace33bf991f8f6643e58a3642962ed244ba36b5b
1 file changed
+12
-2
git-request-pull.sh
+12
-2
@@ -51,8 +51,18 @@ fi
51
tag_name=$(git describe --exact "$head^0" 2>/dev/null)
52
53
test -n "$base" && test -n "$url" || usage
54
-baserev=$(git rev-parse --verify "$base"^0) &&
55
-headrev=$(git rev-parse --verify "$head"^0) || exit
54
+
55
+baserev=$(git rev-parse --verify --quiet "$base"^0)
56
+if test -z "$baserev"
57
+then
58
+ die "fatal: Not a valid revision: $base"
59
+fi
60
+
61
+headrev=$(git rev-parse --verify --quiet "$head"^0)
62
+if test -z "$headrev"
63
+then
64
+ die "fatal: Not a valid revision: $head"
65
+fi
66
67
merge_base=$(git merge-base $baserev $headrev) ||
68
die "fatal: No commits in common between $base and $head"