[PATCH] Add -k kill keyword expansion option to git-cvsimport - revised
[git.git] / git-show-branches-script
1 #!/bin/sh
2 #
3 # Show refs and their recent commits.
4 #
5
6 . git-sh-setup-script || die "Not a git repository"
7
8 headref=`readlink $GIT_DIR/HEAD`
9 case "$#" in
10 0)
11         set x `cd $GIT_DIR/refs &&
12             find heads -type f -print |
13             sed -e 's|heads/||' |
14             sort`
15         shift ;;
16 esac
17
18 hh= in=
19 for ref
20 do
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 "
31 done
32 set x $hh
33 shift
34
35 git-rev-list --pretty=oneline "$@" |
36 while read v l
37 do
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
53 done