git-request-pull.shon commit builtin-fast-export.c: handle nested tags (1982467)
   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='<start> <url> [<end>]'
   8LONG_USAGE='Summarizes the changes between two commits to the standard output,
   9and includes the given URL in the generated summary.'
  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 ls-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