90018a9e88d7a5ec607fb6530449c0a56cca52ac
   1#!/bin/sh
   2#
   3# Show refs and their recent commits.
   4#
   5
   6. git-sh-setup-script || die "Not a git repository"
   7
   8usage () {
   9    die "usage: $0 <ref>..."
  10}
  11
  12headref=`readlink $GIT_DIR/HEAD`
  13
  14case "$(git-rev-parse --no-revs)" in '') ;; *) usage ;; esac
  15revs=$(git-rev-parse --revs-only --symbolic --no-flags "$@")
  16flags=$(git-rev-parse --revs-only --flags "$@")
  17case "$revs" in
  18'')
  19        revs=$(git-rev-parse --symbolic --all | sed -ne 's|^refs/heads/||p' |
  20               sort)
  21        shift ;;
  22esac
  23set x $revs
  24shift
  25
  26hh= in=
  27for ref
  28do
  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 "
  39done
  40set x $hh
  41shift
  42
  43git-rev-list --pretty=oneline $flags $@ |
  44while read v l
  45do
  46        in=''
  47        for h
  48        do
  49                b=`git-merge-base $h $v`
  50                case "$b" in
  51                $v) in="$in+" ;;
  52                *)  in="$in " ;;
  53                esac
  54        done
  55
  56        echo "$in $l"
  57        case "$in" in
  58        *' '*) ;;
  59        *) break ;;
  60        esac
  61done