~ori/git9

b6862274640a138ef1f22ff2d8964b0f8ad55b03 — Ori Bernstein 3 years ago 9f4a26a
ols.c: reset mode
2 files changed, 0 insertions(+), 49 deletions(-)

D log
M ols.c -rwxr-xr-x => -rw-r--r--
D log => log +0 -49
@@ 1,49 0,0 @@
#!/bin/rc -e
rfork en
. /sys/lib/git/common.rc

gitup

flagfmt='e:expr expression, c:branch commit, s:short'; args='file ...'
eval `''{aux/getflags $*} || exec aux/usage

base=/mnt/git/object/
if(~ $#branch 0)
	branch=`{git/branch}
if(~ $#expr 0)
	commits=`{git/query $branch}
if not
	commits=`{git/query $expr}

files=()
if(! ~ $#* 0)
	files=`"{walk -f $gitrel/^$* | subst '^\./' | sort}

while(! ~ $#commits 0){
	ids=$nids
	show=()
	c=$commits(1)
	if(! ~ $#files 0){
		ncomm=`{comm -12 /env/files <{git/query -c $c~ $c | subst '^..' | sort} | wc -l}
		if(! ~ $ncomm 0)
			show=true
	}
	commits=$commits(2-)
	if(~ $#expr 0)
		commits=($commits `{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 || ~ $show true){
		if(~ $short 1)
			echo $c `{cat $base/$c/msg | sed 1q}
		if not{
			echo -n 'Hash:	'`''{cat $base/$c/hash}
			echo -n 'Author:	'`''{cat $base/$c/author}
			echo -n 'Date:	'`''{date `{mtime $base/$c/msg | awk '{print $1}'}}
			subst -g '^' '	' <$base/$c/msg 
			echo
		}
	}
}
exit ''

M ols.c => ols.c +0 -0