Skip to content

Commit

Permalink
request-pull: improve error message for invalid revision args
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dirk Wallenstein authored and Junio C Hamano committed Jul 17, 2013
1 parent 239222f commit ace33bf
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions git-request-pull.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ace33bf

Please sign in to comment.