@matheusbsbs / matheus-bagliano / commits / b37a562a10
Fork 0

Add support for negative refs

You can remove a ref that is packed two different ways: either simply repack all the refs without that one, or create a loose ref that has the magic all-zero SHA1. This also adds back the test that a ref actually has the object it points to. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Linus Torvalds committed Sep 11, 2006 at 20:10 UTC b37a562a1097af7403c649a5f903a93acaf279e8
1 file changed +6
refs.c
+6
@@ -280,6 +280,12 @@ static int do_for_each_ref(const char *base, int (*fn)(const char *path, const u
280 }
281 if (strncmp(base, entry->name, trim))
282 continue;
283 + if (is_null_sha1(entry->sha1))
284 + continue;
285 + if (!has_sha1_file(entry->sha1)) {
286 + error("%s does not point to a valid object!", entry->name);
287 + continue;
288 + }
289 retval = fn(entry->name + trim, entry->sha1);
290 if (retval)
291 return retval;