Skip to content

Commit

Permalink
Add support for negative refs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Linus Torvalds authored and Junio C Hamano committed Sep 18, 2006
1 parent e1e22e3 commit b37a562
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b37a562

Please sign in to comment.