ref: 4bf69ddc03340b250fa581b0f24b4f0649dd29b0
parent: 520c2250d56010bb2f8d36f005a2c0d14eb23cca
author: Ori Bernstein <[email protected]>
date: Thu Oct 24 22:28:38 EDT 2019
Add patched files when importing.
--- a/add
+++ b/add
@@ -35,10 +35,6 @@
if(~ $#rel 0)
rel=''
for(f in $*){
- if(! test -f $base/$rel/$f){
- echo 'could not add '$base/$rel/$f': does not exist' >[1=2]
- exit 'nofile'
- }
addpath=.git/index9/$add/$rel/$f
delpath=.git/index9/$del/$rel/$f
mkdir -p `{basename -d $addpath}
--- a/import
+++ b/import
@@ -85,7 +85,13 @@
flag -e
echo applying $msg | sed 1q
date=`{seconds $date}
- ape/patch -p1 < $diffpath
+ files=`$nl{ape/patch -p1 < $diffpath | sed ''s/^patching file `(.*)''''/\1/''}
+ for(f in $files){
+ if(test -e $f)
+ git/add $f
+ if not
+ git/add -r $f
+ }
git/walk -fRMA
hash=`{git/save -n $name -e $email -m $msg -d $date $parents}
echo $hash > $refpath
--- a/pull
+++ b/pull
@@ -104,4 +104,4 @@
echo $local':' `{git/query $local} '=>' `{git/query $remote} >[1=2]
if(! ~ $#incoming 0)
git/log -q $local'..'$remote
-git/branch -b $remote $local
+git/branch -u -b $remote $local
--- a/walk.c
+++ b/walk.c
@@ -155,6 +155,8 @@
char indexqid[64], fileqid[64], *p;
int fd, n;
+ if(!d)
+ return 0;
if((fd = open(qf, OREAD)) == -1)
return -1;
if((n = readn(fd, indexqid, sizeof(indexqid) - 1)) == -1)
@@ -276,7 +278,7 @@
snprint(tpath, sizeof(tpath), TDIR"/%s", p);
snprint(bpath, sizeof(bpath), HDIR"/%s", p);
d = dirstat(p);
- if(d->mode & DMDIR)
+ if(d && d->mode & DMDIR)
goto next;
if(sameqid(d, tpath)){
if(!quiet && (printflg & Tflg))