ref: b460630cc75d4c144248726bb93d7e421bb5c5bc
dir: /log/
#!/bin/rc -e rfork en nl=' ' fn usage { echo usage: $0 '[-b branch] [file ...]' >[1=2] exit usage } base=/mnt/git/object/ git/fs branch=master while(~ $1 -* && ! ~ $1 --){ switch($1){ case -b branch=$2 shift case * usage } shift } if(~ $1 --) shift commits=`{git/query $branch} files=() if(! ~ $#* 0) files=`$nl{walk -f $*} if(! ~ $#files 0) nids=`{sha1sum $base/$commits(1)^/tree/$files | awk '{print $1}' >[2]/dev/null} while(! ~ $#commits 0){ ids=$nids c=$commits(1) if(! ~ $#files 0) nids=`{sha1sum $base/$commits(1)^/tree/$files | awk '{print $1}' >[2]/dev/null} commits=($commits(2-) `{cat $base/$c/parent >[2]/dev/null}) if(! ~ $#commits 0) commits=`$nl{walk -emp -n0 $base^$commits | sort -rn | uniq | awk -F/ '{print $NF}'} if(~ $#files 0 || ! ~ $"ids $"nids || ~ $#commits 0){ echo 'Hash: '^`''{cat $base/$c/hash}^'Author: '^`''{cat $base/$c/author} sed 's/^/ /g' $base/$c/msg echo } }