git-request-pull.shon commit Merge branch 'maint' (bd8ff61)
   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
   7USAGE='<commit> <url> [<head>]'
   8LONG_USAGE='Summarizes the changes since <commit> to the standard output,
   9and includes <url> in the message generated.'
  10SUBDIRECTORY_OK='Yes'
  11OPTIONS_SPEC=
  12. git-sh-setup
  13. git-parse-remote
  14
  15base=$1
  16url=$2
  17head=${3-HEAD}
  18
  19[ "$base" ] || usage
  20[ "$url" ] || usage
  21
  22baserev=`git rev-parse --verify "$base"^0` &&
  23headrev=`git rev-parse --verify "$head"^0` || exit
  24
  25merge_base=`git merge-base $baserev $headrev` ||
  26die "fatal: No commits in common between $base and $head"
  27
  28url=$(get_remote_url "$url")
  29branch=$(git peek-remote "$url" \
  30        | sed -n -e "/^$headrev refs.heads./{
  31                s/^.*   refs.heads.//
  32                p
  33                q
  34        }")
  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
  45PAGER=
  46export PAGER
  47echo "The following changes since commit $baserev:"
  48git shortlog --max-count=1 $baserev | sed -e 's/^\(.\)/  \1/'
  49
  50echo "are available in the git repository at:"
  51echo
  52echo "  $url $branch"
  53echo
  54
  55git shortlog ^$baserev $headrev
  56git diff -M --stat --summary $merge_base $headrev
  57exit $status