Skip to content

Commit 3c9f1e7

Browse files
committed
request-pull: modernize style
Make it a bit more conforming to Documentation/Codingstyle Signed-off-by: Junio C Hamano <[email protected]>
1 parent b7200e8 commit 3c9f1e7

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

git-request-pull.sh

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,24 @@ do
3535
shift
3636
done
3737

38-
base=$1
39-
url=$2
40-
head=${3-HEAD}
38+
base=$1 url=$2 head=${3-HEAD}
4139

42-
[ "$base" ] || usage
43-
[ "$url" ] || usage
40+
test -n "$base" && test -n "$url" || usage
41+
baserev=$(git rev-parse --verify "$base"^0) &&
42+
headrev=$(git rev-parse --verify "$head"^0) || exit
4443

45-
baserev=`git rev-parse --verify "$base"^0` &&
46-
headrev=`git rev-parse --verify "$head"^0` || exit
47-
48-
merge_base=`git merge-base $baserev $headrev` ||
44+
merge_base=$(git merge-base $baserev $headrev) ||
4945
die "fatal: No commits in common between $base and $head"
5046

51-
branch=$(git ls-remote "$url" \
52-
| sed -n -e "/^$headrev refs.heads./{
53-
s/^.* refs.heads.//
54-
p
55-
q
56-
}")
47+
find_matching_branch="/^$headrev "'refs\/heads\//{
48+
s/^.* refs\/heads\///
49+
p
50+
q
51+
}'
52+
branch=$(git ls-remote "$url" | sed -n -e "$find_matching_branch")
5753
url=$(git ls-remote --get-url "$url")
58-
if [ -z "$branch" ]; then
54+
if test -z "$branch"
55+
then
5956
echo "warn: No branch of $url is at:" >&2
6057
git log --max-count=1 --pretty='tformat:warn: %h: %s' $headrev >&2
6158
echo "warn: Are you sure you pushed $head there?" >&2

0 commit comments

Comments
 (0)