ref: 434d68716062b098d92d7fdfc1bc2ffaf229a23b
parent: ec707628ca8f461a1088a2a9e07bd89f0990338f
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Dec 7 17:20:42 EST 2019
Allow committing and addign from a subdirectory.
--- a/add
+++ b/add
@@ -24,13 +24,12 @@
if(~ $1 --)
shift
-rel=`{sed 's@^'$gitroot'/*@@' <{echo $dir}}
if(~ $#rel 0)
rel=''
-for(f in `{walk -f $*}){
+for(f in `{walk -f $gitrel/$*}){
if(! ~ `{cleanname $f} .git/*){
- addpath=.git/index9/$add/$rel/$f
- delpath=.git/index9/$del/$rel/$f
+ addpath=.git/index9/$add/$f
+ delpath=.git/index9/$del/$f
mkdir -p `{basename -d $addpath}
mkdir -p `{basename -d $delpath}
if(! test -e $addpath)
--- a/commit
+++ b/commit
@@ -101,9 +101,9 @@
mkdir -p .git/refs
if(~ $#* 0)
usage
-files=`{git/walk -c $*}
-if(~ $status '' || ~ $#files 0asdf)
- die 'nothing to commit'
+files=`{git/walk -c `{cleanname $gitrel/$*}}
+if(~ $status '' || ~ $#files 0)
+ die 'nothing to commit' $status
@{
flag e +
whoami
--- a/common.rc
+++ b/common.rc
@@ -13,8 +13,11 @@
fn gitup{
gitroot=`{git/conf -r >[2]/dev/null}
+ gitrel=`{pwd | sed 's@^'$gitroot'/*@@'}
if(~ $#gitroot 0)
die 'not a git repository'
+ if(~ $#gitrel 0)
+ gitrel='.'
cd $gitroot
git/fs
}