Remove usage of git- (dash) commands from email hook
[git/platforms.git] / git-request-pull.sh
blob068f5e0fc7308db601141bc3e70475ec2145ef67
1 #!/bin/sh -e
2 # Copyright 2005, Ryan Anderson <ryan@michonline.com>
4 # This file is licensed under the GPL v2, or a later version
5 # at the discretion of Linus Torvalds.
7 USAGE='<commit> <url> [<head>]'
8 LONG_USAGE='Summarizes the changes since <commit> to the standard output,
9 and includes <url> in the message generated.'
10 SUBDIRECTORY_OK='Yes'
11 OPTIONS_SPEC=
12 . git-sh-setup
13 . git-parse-remote
15 base=$1
16 url=$2
17 head=${3-HEAD}
19 [ "$base" ] || usage
20 [ "$url" ] || usage
22 baserev=`git rev-parse --verify "$base"^0` &&
23 headrev=`git rev-parse --verify "$head"^0` || exit
25 merge_base=`git merge-base $baserev $headrev` ||
26 die "fatal: No commits in common between $base and $head"
28 url=$(get_remote_url "$url")
29 branch=$(git peek-remote "$url" \
30 | sed -n -e "/^$headrev refs.heads./{
31 s/^.* refs.heads.//
34 }")
35 if [ -z "$branch" ]; then
36 echo "warn: No branch of $url is at:" >&2
37 git log --max-count=1 --pretty='format:warn: %h: %s' $headrev >&2
38 echo "warn: Are you sure you pushed $head there?" >&2
39 echo >&2
40 echo >&2
41 branch=..BRANCH.NOT.VERIFIED..
42 status=1
45 PAGER=
46 export PAGER
47 echo "The following changes since commit $baserev:"
48 git shortlog --max-count=1 $baserev | sed -e 's/^\(.\)/ \1/'
50 echo "are available in the git repository at:"
51 echo
52 echo " $url $branch"
53 echo
55 git shortlog ^$baserev $headrev
56 git diff -M --stat --summary $merge_base $headrev
57 exit $status