diff --git a/branch b/branch index eb34812..0f0c2d8 100755 --- a/branch +++ b/branch @@ -30,18 +30,18 @@ if not new=refs/heads/$branch if (~ $#baseref 1) - base=`{/$cputype/bin/git/query $baseref} || exit 'bad base' + base=`{git/query $baseref} || exit 'bad base' if not if(test -e .git/$new) - base=`{/$cputype/bin/git/query $new} + base=`{git/query $new} if not - base=`{/$cputype/bin/git/query HEAD} + base=`{git/query HEAD} -modified=`$nl{/$cputype/bin/git/query -c HEAD $base | grep '^[^-]' | subst '^..'} -deleted=`$nl{/$cputype/bin/git/query -c HEAD $base | grep '^-' | subst '^..'} +modified=`$nl{git/query -c HEAD $base | grep '^[^-]' | subst '^..'} +deleted=`$nl{git/query -c HEAD $base | grep '^-' | subst '^..'} if(! ~ $#modified 0 || ! ~ $#deleted 0){ - if(! /$cputype/bin/git/walk -q $modified $deleted){ - /$cputype/bin/git/walk -fRMA $modified $deleted + if(! git/walk -q $modified $deleted){ + git/walk -fRMA $modified $deleted die 'uncommited changes would be clobbered' } } @@ -56,7 +56,7 @@ if(~ $#newbr 0){ if(! ~ $#baseref 0) die update would clobber $branch with $baseref } -commit=`{/$cputype/bin/git/query $base} || die 'branch does not exist:' $base +commit=`{git/query $base} || die 'branch does not exist:' $base echo updating $new to $commit echo $commit > .git/$new @@ -65,7 +65,7 @@ if(! ~ $#stay 0) exit if(! ~ $#modified 0){ - basedir=`{/$cputype/bin/git/query -p $base} + basedir=`{git/query -p $base} for(m in $modified){ d=`{basename -d $m} mkdir -p $d diff --git a/clone b/clone index 5ae68f5..680b7e5 100755 --- a/clone +++ b/clone @@ -30,7 +30,7 @@ fn clone{ echo ' url='$remote echo ' fetch=+refs/heads/*:refs/remotes/origin/*' } - {/$cputype/bin/git/fetch $remote >[2=3] | awk ' + {git/fetch $remote >[2=3] | awk ' /^remote/{ if($2=="HEAD"){ headhash=$3 @@ -64,12 +64,12 @@ fn clone{ '} |[3] tr '\x0d' '\x0a' || die 'could not clone repository' tree=/mnt/git/HEAD/tree - lbranch=`{/$cputype/bin/git/branch} + lbranch=`{git/branch} rbranch=`{echo $lbranch | subst '^heads' 'remotes/origin'} echo checking out repository... if(test -f .git/refs/$rbranch){ cp .git/refs/$rbranch .git/refs/$lbranch - /$cputype/bin/git/fs + git/fs @ {builtin cd $tree && tar cif /fd/1 .} | @ {tar xf /fd/0} \ || die 'checkout failed:' $status for(f in `$nl{walk -f $tree | subst '^'$tree'/*'}){ diff --git a/commit b/commit index e170056..5abdd13 100755 --- a/commit +++ b/commit @@ -3,8 +3,8 @@ rfork ne . /sys/lib/git/common.rc fn whoami{ - name=`{/$cputype/bin/git/conf user.name} - email=`{/$cputype/bin/git/conf user.email} + name=`{git/conf user.name} + email=`{git/conf user.email} if(test -f /adm/keys.who){ if(~ $name '') name=`{awk -F'|' '$1=="'$user'" {x=$3} END{print x}' $msgfile.tmp -files=`{/$cputype/bin/git/walk -c `{cleanname $gitrel/$*}} +files=`{git/walk -c `{cleanname $gitrel/$*}} if(~ $status '' || ~ $#files 0 && ! test -f .git/index9/merge-parents) die 'nothing to commit' $status @{ diff --git a/common.rc b/common.rc index e436513..b13d918 100644 --- a/common.rc +++ b/common.rc @@ -31,7 +31,7 @@ fn subst{ } fn gitup{ - gitroot=`{/$cputype/bin/git/conf -r >[2]/dev/null} + gitroot=`{git/conf -r >[2]/dev/null} if(~ $#gitroot 0) die 'not a git repository' gitrel=`{pwd | subst '^'$"gitroot'/?'} @@ -44,7 +44,7 @@ fn gitup{ if(! grep -s '^repo '$gitroot'$' /mnt/git/ctl >[2]/dev/null) startfs=true if(~ $#startfs 1) - /$cputype/bin/git/fs + git/fs if not status='' } diff --git a/compat b/compat index f8f4697..0e61cab 100644 --- a/compat +++ b/compat @@ -20,7 +20,7 @@ fn cmd_init{ shift } ls >[1=2] - /$cputype/bin/git/init $opts $args + git/init $opts $args } fn cmd_clone{ @@ -39,15 +39,15 @@ fn cmd_clone{ } shift } - /$cputype/bin/git/clone $opts $args + git/clone $opts $args if(~ $#branch 1) - /$cputype/bin/git/branch -n -b $1 origin/$1 + git/branch -n -b $1 origin/$1 } fn cmd_pull{ if(~ $1 -*) die unknown options for pull $* - /$cputype/bin/git/pull + git/pull } fn cmd_fetch{ @@ -67,7 +67,7 @@ fn cmd_fetch{ } shift } - /$cputype/bin/git/pull -f $opts + git/pull -f $opts } @@ -76,7 +76,7 @@ fn cmd_checkout{ die unknown command pull $* if(~ $#* 0) die git checkout branch - /$cputype/bin/git/branch $b + git/branch $b } fn rev-parse{ diff --git a/diff b/diff index fb001af..0b3990a 100755 --- a/diff +++ b/diff @@ -12,14 +12,14 @@ if(~ $#commit 0) files=() if(! ~ $#* 0) files=`{cleanname $gitrel/$*} -branch=`{/$cputype/bin/git/query -p $commit} +branch=`{git/query -p $commit} if(~ $summarize 1){ - /$cputype/bin/git/walk -fMAR $files + git/walk -fMAR $files exit } -dirty=`$nl{/$cputype/bin/git/walk -c -fRMA $files} +dirty=`$nl{git/walk -c -fRMA $files} if(! ~ $commit HEAD) - dirty=($dirty `$nl{/$cputype/bin/git/query -c $commit HEAD | subst '^..'}) + dirty=($dirty `$nl{git/query -c $commit HEAD | subst '^..'}) for(f in $dirty){ orig=$branch/tree/$f if(! test -f $orig) diff --git a/export b/export index 350f0e1..77908ba 100755 --- a/export +++ b/export @@ -19,13 +19,13 @@ if(~ $#patchdir 1 && ! test -d $patchdir) q=$* if(~ $#q 0) q=HEAD -commits=`{/$cputype/bin/git/query $q || die $status} +commits=`{git/query $q || die $status} n=1 m=$#commits mntgen /mnt/scratch for(c in $commits){ - cp=`{/$cputype/bin/git/query -p $c} - pp=`{/$cputype/bin/git/query -p $c'^'} + cp=`{git/query -p $c} + pp=`{git/query -p $c'^'} @{ rfork n diff --git a/import b/import index f945b2b..93a4945 100755 --- a/import +++ b/import @@ -8,12 +8,12 @@ fn sigexit { } fn apply @{ - /$cputype/bin/git/fs + git/fs email='' name='' msg='' - parents='-p'^`{/$cputype/bin/git/query HEAD} - branch=`{/$cputypeb/in/git/branch} + parents='-p'^`{git/query HEAD} + branch=`{git/branch} if(test -e /mnt/git/branch/$branch/tree) refpath=.git/refs/$branch if not if(test -e /mnt/git/object/$branch/tree) @@ -77,12 +77,12 @@ fn apply @{ files=`$nl{ape/patch -Ep1 < $diffpath | sed ''s/^patching file `(.*)''''/\1/''} for(f in $files){ if(test -e $f) - /$cputype/bin/git/add $f + git/add $f if not - /$cputype/bin/git/add -r $f + git/add -r $f } - /$cputype/bin/git/walk -fRMA $files - hash=`{/$cputype/bin/git/save -n $name -e $email -m $msg -d $date $parents $files} + git/walk -fRMA $files + hash=`{git/save -n $name -e $email -m $msg -d $date $parents $files} echo $hash > $refpath ' } diff --git a/log b/log index dc1990e..6b420af 100755 --- a/log +++ b/log @@ -9,11 +9,11 @@ eval `''{aux/getflags $*} || exec aux/usage base=/mnt/git/object/ if(~ $#branch 0) - branch=`{/$cputype/bin/git/branch} + branch=`{git/branch} if(~ $#expr 0) - commits=`{/$cputype/bin/git/query $branch} + commits=`{git/query $branch} if not - commits=`{/$cputype/bin/git/query $expr} + commits=`{git/query $expr} files=() if(! ~ $#* 0) @@ -24,7 +24,7 @@ while(! ~ $#commits 0){ show=() c=$commits(1) if(! ~ $#files 0){ - ncomm=`{comm -12 /env/files <{/$cputype/bin/git/query -c $c~ $c | subst '^..' | sort} | wc -l} + ncomm=`{comm -12 /env/files <{git/query -c $c~ $c | subst '^..' | sort} | wc -l} if(! ~ $ncomm 0) show=true } diff --git a/merge b/merge index 67d50fe..0c751e5 100755 --- a/merge +++ b/merge @@ -23,9 +23,9 @@ fn merge{ echo merge needed: $f if(test -f $f) - /$cputype/bin/git/add $f + git/add $f if not - /$cputype/bin/git/rm $f + git/rm $f } } @@ -37,18 +37,18 @@ eval `''{aux/getflags $*} || exec aux/usage if(! ~ $#* 1) exec aux/usage -theirs=`{/$cputytpe/bin/git/query $1} -ours=`{/$cputype/bin/git/query HEAD} -base=`{/$cputype/bin/git/query $theirs ^ ' ' ^ $ours ^ '@'} +theirs=`{git/query $1} +ours=`{git/query HEAD} +base=`{git/query $theirs ^ ' ' ^ $ours ^ '@'} if(~ $base $theirs) die 'nothing to merge, doofus' -if(! /$cputype/bin/git/walk -q) +if(! git/walk -q) die 'dirty work tree, refusing to merge' if(~ $base $ours){ >[1=2] echo 'fast forwarding...' - echo $theirs > .git/refs/`{/$cputype/bin/git/branch} - /$cputype/bin/git/revert . + echo $theirs > .git/refs/`{git/branch} + git/revert . exit '' } echo $ours >> .git/index9/merge-parents diff --git a/mkfile b/mkfile index e3b8889..8ea6c2b 100644 --- a/mkfile +++ b/mkfile @@ -17,7 +17,6 @@ RC=\ branch\ clone\ commit\ - compat\ diff\ export\ import\ diff --git a/pull b/pull index 9e7da61..7d23b7b 100755 --- a/pull +++ b/pull @@ -10,7 +10,7 @@ fn update{ bflag=() if(! ~ $branch '') bflag=(-b $branch) - {/$cputype/bin/git/fetch $bflag -u $upstream $url >[2=3] || die $status} | awk ' + {git/fetch $bflag -u $upstream $url >[2=3] || die $status} | awk ' /^remote/{ if($2=="HEAD") next @@ -33,13 +33,13 @@ args='' eval `''{aux/getflags $*} || exec aux/usage if(~ $#branch 0) - branch=refs/`{/$cputype/bin/git/branch} + branch=refs/`{git/branch} if(~ $allbranch 1) branch='' if(~ $#upstream 0) upstream=origin -remote=`{/$cputype/bin/git/conf 'remote "'$upstream'".url'} +remote=`{git/conf 'remote "'$upstream'".url'} if(~ $#remote 0) die 'no remote to pull from' @@ -47,31 +47,31 @@ update $branch $upstream $remote if (~ $fetchonly 1) exit -local=`{//$cputype/bin/git/branch} -remote=`{/$cputype/bin/git/branch | subst '^(refs/)?heads' 'remotes/'$upstream} +local=`{git/branch} +remote=`{git/branch | subst '^(refs/)?heads' 'remotes/'$upstream} # we have local commits, but the remote hasn't changed. # in this case, we want to keep the local commits untouched. -if(~ `{/$cputype/bin/git/query HEAD $remote @} `{/$cputype/bin/git/query $remote}){ +if(~ `{git/query HEAD $remote @} `{git/query $remote}){ echo 'up to date' >[1=2] exit } # The remote repository and our HEAD have diverged: we # need to merge. -if(! ~ `{/$cputype/bin/git/query HEAD $remote @} `{/$cputype/bin/git/query HEAD}){ +if(! ~ `{git/query HEAD $remote @} `{git/query HEAD}){ >[1=2]{ - echo ours: `{/$cputype/bin/git/query HEAD} - echo theirs: `{/$cputype/bin/git/query $remote} - echo common: `{/$cputype/bin/git/query HEAD $remote @} + echo ours: `{git/query HEAD} + echo theirs: `{git/query $remote} + echo common: `{git/query HEAD $remote @} echo git/merge $remote } exit diverged } # The remote is directly ahead of the local, and we have # no local commits that need merging. -if(~ $quiet 0) - /$cputype/bin/git/log -s -e $local'..'$remote >[1=2] +if(~ $#quiet 0) + git/log -s -e $local'..'$remote >[1=2] echo -echo $remote':' `{/$cputype/bin/git/query $local} '=>' `{/$cputype/bin/git/query $remote} >[1=2] -/$cputype/bin/git/branch -n -b $remote $local +echo $remote':' `{git/query $local} '=>' `{git/query $remote} >[1=2] +git/branch -n -b $remote $local exit '' diff --git a/push b/push index 3b417fa..d66c86f 100755 --- a/push +++ b/push @@ -13,7 +13,7 @@ if(! ~ $#* 0) if(~ $pushall 1) branch=`$nl{cd .git/refs/heads && walk -f} if(~ $#branch 0) - branch=`{/$cputype/bin/git/branch} + branch=`{git/branch} if(~ $#branch 0) die 'no branches' if(~ $force 1) @@ -24,13 +24,13 @@ if(~ $debug 1) if(~ $#upstream 0) upstream=origin -remote=`{/$cputype/bin/git/conf 'remote "'$upstream'".url'} +remote=`{git/conf 'remote "'$upstream'".url'} if(~ $#remote 0) remote=$upstream branch=-b^$branch if(! ~ $#remove 0) remove=-r^$remove -updates=`$nl{/$cputype/bin/git/send $debug $force $branch $remove $remote || die $status} +updates=`$nl{git/send $debug $force $branch $remove $remote || die $status} for(ln in $updates){ u=`{echo $ln} refpath=`{echo $u(2) | subst '^refs/heads/' '.git/refs/remotes/'$upstream'/'} diff --git a/rm b/rm index f3a1219..deaf3ae 100755 --- a/rm +++ b/rm @@ -1,3 +1,3 @@ #!/bin/rc -e -exec /$cputype/bin/git/add -r $* +exec git/add -r $*