2010-10-27 15:11:19 +02:00
|
|
|
#!/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
|
|
|
|
|
2010-10-27 19:38:58 +02:00
|
|
|
# get_rights_and_owner now also sets $repo; see comments in common functions
|
|
|
|
get_rights_and_owner $1
|
2010-10-27 15:11:19 +02:00
|
|
|
[ -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
|
2011-02-24 12:15:44 +01:00
|
|
|
< $logdir/$lf perl -ne "print if /receive-pack.*\s$repo\s/" | cut -f1,2,3,5- | tac
|
2010-10-27 15:11:19 +02:00
|
|
|
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
|