[PATCH] Add Makefile target glossary.html
[git/dscho.git] / git-show-branches-script
blob90018a9e88d7a5ec607fb6530449c0a56cca52ac
1 #!/bin/sh
3 # Show refs and their recent commits.
6 . git-sh-setup-script || die "Not a git repository"
8 usage () {
9 die "usage: $0 <ref>..."
12 headref=`readlink $GIT_DIR/HEAD`
14 case "$(git-rev-parse --no-revs)" in '') ;; *) usage ;; esac
15 revs=$(git-rev-parse --revs-only --symbolic --no-flags "$@")
16 flags=$(git-rev-parse --revs-only --flags "$@")
17 case "$revs" in
18 '')
19 revs=$(git-rev-parse --symbolic --all | sed -ne 's|^refs/heads/||p' |
20 sort)
21 shift ;;
22 esac
23 set x $revs
24 shift
26 hh= in=
27 for ref
29 case "/$headref" in
30 */"$ref") H='*' ;;
31 *) H='!' ;;
32 esac
33 h=`git-rev-parse --verify "$ref^0" 2>/dev/null` || continue
34 l=`git-log-script --max-count=1 --pretty=oneline "$h" |
35 sed -e 's/^[^ ]* //'`
36 hh="$hh $h"
37 echo "$in$H [$ref] $l"
38 in="$in "
39 done
40 set x $hh
41 shift
43 git-rev-list --pretty=oneline $flags $@ |
44 while read v l
46 in=''
47 for h
49 b=`git-merge-base $h $v`
50 case "$b" in
51 $v) in="$in+" ;;
52 *) in="$in " ;;
53 esac
54 done
56 echo "$in $l"
57 case "$in" in
58 *' '*) ;;
59 *) break ;;
60 esac
61 done