From: Linus Torvalds Date: Tue, 12 Sep 2006 03:10:15 +0000 (-0700) Subject: Add support for negative refs X-Git-Tag: v1.4.4-rc1~43^2~38 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b37a562a1097af7403c649a5f903a93acaf279e8;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/refs.c b/refs.c index 5f80a6892..72e22834f 100644 --- a/refs.c +++ b/refs.c @@ -280,6 +280,12 @@ static int do_for_each_ref(const char *base, int (*fn)(const char *path, const u } if (strncmp(base, entry->name, trim)) continue; + if (is_null_sha1(entry->sha1)) + continue; + if (!has_sha1_file(entry->sha1)) { + error("%s does not point to a valid object!", entry->name); + continue; + } retval = fn(entry->name + trim, entry->sha1); if (retval) return retval;