shithub: git9

Download patch

ref: 522488b641afb2c01be37a1ace0ff10ff12219ce
parent: 513bda7539f41b108d4441f815df3370332ea128
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Aug 22 23:56:40 EDT 2020

oops: committed wrong version.

Discovered a bug in upstream git as I was
writing this code, so I introduced a bug
into repack to tickle it -- and committed
the intentionally buggy code.

--- a/repack.c
+++ b/repack.c
@@ -98,7 +98,7 @@
 		return 0;
 	if((t = readobject(tree)) == nil)
 		return -1;
-//	osadd(has, t);
+	osadd(has, t);
 	addmeta(m, nm, t->type, t->hash, dpath, mtime);
 	for(i = 0; i < t->tree->nent; i++){
 		e = &t->tree->ent[i];
@@ -110,11 +110,10 @@
 		o = clearedobject(e->h, k);
 		p = smprint("%s/%s", dpath, e->name);
 		addmeta(m, nm, k, o->hash, p, mtime);
-//		if(k == GBlob)
-//			osadd(has, o);
-		if(k == GTree && loadtree(m, nm, e->h, p, mtime, has) == -1)
+		if(k == GBlob)
+			osadd(has, o);
+		else if(loadtree(m, nm, e->h, p, mtime, has) == -1)
 			return -1;
-		osadd(has, o);
 	}
 	unref(t);
 	return 0;