]> git.ipfire.org Git - thirdparty/git.git/blame - git-request-pull.sh
attr: plug minor memory leak
[thirdparty/git.git] / git-request-pull.sh
CommitLineData
ab421d2c
RA
1#!/bin/sh -e
2# Copyright 2005, Ryan Anderson <ryan@michonline.com>
3#
4# This file is licensed under the GPL v2, or a later version
5# at the discretion of Linus Torvalds.
6
3eb91bfc
SN
7USAGE='<start> <url> [<end>]'
8LONG_USAGE='Summarizes the changes between two commits to the standard output,
9and includes the given URL in the generated summary.'
806f36d4 10SUBDIRECTORY_OK='Yes'
8f321a39 11OPTIONS_SPEC=
806f36d4 12. git-sh-setup
ff06c743 13. git-parse-remote
ab421d2c 14
ff06c743 15base=$1
9969b649
JH
16url=$2
17head=${3-HEAD}
ab421d2c 18
ff06c743 19[ "$base" ] || usage
ab421d2c
RA
20[ "$url" ] || usage
21
5be60078
JH
22baserev=`git rev-parse --verify "$base"^0` &&
23headrev=`git rev-parse --verify "$head"^0` || exit
ab421d2c 24
ff06c743
SP
25merge_base=`git merge-base $baserev $headrev` ||
26die "fatal: No commits in common between $base and $head"
27
b5e960b1 28url=$(get_remote_url "$url")
74982056 29branch=$(git ls-remote "$url" \
ff06c743
SP
30 | sed -n -e "/^$headrev refs.heads./{
31 s/^.* refs.heads.//
32 p
33 q
b5e960b1 34 }")
ff06c743
SP
35if [ -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
43fi
44
476cc724
JH
45GIT_PAGER=
46export GIT_PAGER
9969b649 47echo "The following changes since commit $baserev:"
ff06c743 48git shortlog --max-count=1 $baserev | sed -e 's/^\(.\)/ \1/'
ab421d2c 49
ff06c743 50echo "are available in the git repository at:"
9969b649 51echo
ff06c743 52echo " $url $branch"
9969b649 53echo
ab421d2c 54
ff06c743
SP
55git shortlog ^$baserev $headrev
56git diff -M --stat --summary $merge_base $headrev
57exit $status