mirror of
https://github.com/git/git.git
synced 2024-11-02 15:28:21 +01:00
86947d72d4
This lets you say "git show-branches --max-count=30". Signed-off-by: Junio C Hamano <junkio@cox.net>
61 lines
1,020 B
Bash
Executable file
61 lines
1,020 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Show refs and their recent commits.
|
|
#
|
|
|
|
. git-sh-setup-script || die "Not a git repository"
|
|
|
|
usage () {
|
|
die "usage: $0 <ref>..."
|
|
}
|
|
|
|
headref=`readlink $GIT_DIR/HEAD`
|
|
|
|
case "$(git-rev-parse --no-revs)" in '') ;; *) usage ;; esac
|
|
revs=$(git-rev-parse --revs-only --symbolic --no-flags "$@")
|
|
flags=$(git-rev-parse --revs-only --flags "$@")
|
|
case "$revs" in
|
|
'')
|
|
revs=$(git-rev-parse --symbolic --all | sed -ne 's|^refs/heads/||p' |
|
|
sort)
|
|
shift ;;
|
|
esac
|
|
set x $revs
|
|
shift
|
|
|
|
hh= in=
|
|
for ref
|
|
do
|
|
case "/$headref" in
|
|
*/"$ref") H='*' ;;
|
|
*) H='!' ;;
|
|
esac
|
|
h=`git-rev-parse --verify "$ref^0" 2>/dev/null` || continue
|
|
l=`git-log-script --max-count=1 --pretty=oneline "$h" |
|
|
sed -e 's/^[^ ]* //'`
|
|
hh="$hh $h"
|
|
echo "$in$H [$ref] $l"
|
|
in="$in "
|
|
done
|
|
set x $hh
|
|
shift
|
|
|
|
git-rev-list --pretty=oneline $flags $@ |
|
|
while read v l
|
|
do
|
|
in=''
|
|
for h
|
|
do
|
|
b=`git-merge-base $h $v`
|
|
case "$b" in
|
|
$v) in="$in+" ;;
|
|
*) in="$in " ;;
|
|
esac
|
|
done
|
|
|
|
echo "$in $l"
|
|
case "$in" in
|
|
*' '*) ;;
|
|
*) break ;;
|
|
esac
|
|
done
|