1#!/bin/sh
2#
3# Show refs and their recent commits.
4#
5
6. git-sh-setup-script || die "Not a git repository"
7
8headref=`readlink $GIT_DIR/HEAD`
9case "$#" in
100)
11 set x `cd $GIT_DIR/refs &&
12 find heads -type f -print |
13 sed -e 's|heads/||' |
14 sort`
15 shift ;;
16esac
17
18hh= in=
19for ref
20do
21 case "/$headref" in
22 */"$ref") H='*' ;;
23 *) H='!' ;;
24 esac
25 h=`git-rev-parse --verify "$ref^0"` || exit
26 l=`git-log-script --max-count=1 --pretty=oneline "$h" |
27 sed -e 's/^[^ ]* //'`
28 hh="$hh $h"
29 echo "$in$H [$ref] $l"
30 in="$in "
31done
32set x $hh
33shift
34
35git-rev-list --pretty=oneline "$@" |
36while read v l
37do
38 in=''
39 for h
40 do
41 b=`git-merge-base $h $v`
42 case "$b" in
43 $v) in="$in+" ;;
44 *) in="$in " ;;
45 esac
46 done
47
48 echo "$in $l"
49 case "$in" in
50 *' '*) ;;
51 *) break ;;
52 esac
53done