ref: e1e84b5214aac5d38263f5c8bfc4d88f698d68d6
parent: 65fb94d4bf489d39ca2e6d744633822e7c435b4b
author: Ori Bernstein <ori@eigenstate.org>
date: Thu Dec 5 23:52:47 EST 2019
first steps towards working on 9legacy: remove rc from awk system(), fix postincr.
--- a/clone
+++ b/clone
@@ -38,7 +38,9 @@
if($2 == "refs/remotes/origin/master" || $3 == headhash)
headref=$2
outfile = ".git/" $2
- system("mkdir -p `{basename -d "outfile"}")
+ outdir = outfile
+ gsub("/?[^/]*/?$", "", outdir)
+ system("mkdir -p "outdir)
print $3 > outfile
close(outfile)
}
@@ -45,9 +47,11 @@
}
END{
if(headref != ""){
- remote = headref
+ remote = headref;
+ refdir = headref;
+ gsub("/?[^/]*/?$", "", refdir)
gsub("^refs/remotes/origin", "refs/heads", headref)
- system("mkdir -p `{basename -d .git/" headref"}");
+ system("mkdir -p .git/"refdir);
system("cp .git/" remote " .git/" headref)
print "ref: " headref > ".git/HEAD"
}else if(headhash != ""){
--- a/fs.c
+++ b/fs.c
@@ -107,7 +107,8 @@
c->cache = erealloc(c->cache, c->max*sizeof(Uqid));
}
nextqid++;
- c->cache[c->n++] = (Uqid){nextqid, pp, id, t, idx};
+ c->cache[c->n] = (Uqid){nextqid, pp, id, t, idx};
+ c->n++;
return (nextqid << 8) | t;
}