Plan 9 from Bell Labs’s /usr/web/sources/contrib/yk/root/rc/bin/git/hist

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc
rfork ne

. /rc/bin/git/defs
gitup

flagfmt='n count'; args='files...'
ifs=() {eval `{aux/getflags $*}} || exec aux/usage
if(~ $#* 0) exec aux/usage
num=$flagn

fn dodiff {
	while(t=`{read}){
		h=$t(1)
		o=$gitfs/object/`{git/query $h~}
		c=$gitfs/object/$h
		echo 'Hash:' $h
		echo -n 'Date: '; date `{walk -em $c/msg}
		echo -n 'Author: '; cat $c/author
		echo -n 'Message: '; cat $c/msg
		echo
		for(f in $files){
			curr=$c/tree/$f
			prev=$o/tree/$f
			if(! test -e $curr)
				curr=/dev/null
			if(! test -e $prev)
				prev=/dev/null
			diff -u $prev $curr
		}
		echo --' '
		echo ⑨
		echo
	}
}

files=`{cleanname -d $gitrel $*}
args=(-s $files)
if(! ~ $#num 0)
	args=(-n $num $args)
git/log $args | dodiff

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.