gitolite/contrib/adc/who-pushed
Sitaram Chamarty 5b3dcb3757 a slew of adc changes; details below:
- get_rights_and_owner normalises its arg1 by stripping .git if
    supplied, then sets the variable "repo" to the result as a side
    effect
  - new "help" adc with some default text but main purpose is to allow
    site local help text
  - other adc's refer to 'help' adc when appropriate
  - 'undelete' renamed to 'restore'; that's what the KDE "trashcan"
    program calls that operation
  - minor typo in sample script in documentation
  - main adc doc points to contrib/adc/repo-deletion.README now
2010-10-28 16:43:04 +05:30

34 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
# find the last person to push the given commit
# XXX we assume the logfile names have been left as default, or at least, if
# changed, in such a way that when sorted by "ls", they come up oldest first
. $(dirname $0)/adc.common-functions
sha=$2
[ -n "$sha" ] || die Usage: ssh ... who-pushed reponame SHA \# at least first few hex digits
# get_rights_and_owner now also sets $repo; see comments in common functions
get_rights_and_owner $1
[ -z "$perm_read" ] && die "no read permissions on $repo"
cd $GL_REPO_BASE_ABS/$repo.git
logdir=$(dirname $GL_LOG) # uncodumented env var ;-)
ls $logdir | tac | while read lf
do
< $logdir/$lf grep receive-pack | egrep "\s$repo\s" | cut -f1,2,3,5- | tac
done | while read ts who IP perm old new repo ref rule
do
save_old=$old
[ "$new" = "00000000000000" ] && continue
[ -z "$old" ] && continue
[ "$old" = "00000000000000" ] && old=
[ -n "$old" ] && old=$old..
git rev-list $old$new 2>/dev/null | grep ^$sha >/dev/null &&
printf "$ts $who $IP $perm $save_old $new $repo $ref $rule\n"
done