From: Linus Torvalds <torvalds@osdl.org>
To: Junio C Hamano <junkio@cox.net>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Add support for negative refs
Date: Mon, 11 Sep 2006 20:10:15 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0609112008500.27779@g5.osdl.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0609111632050.27779@g5.osdl.org>
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>
---
This one is trivial, and obviously depends on the previous series.
I'm sending it just because I have a much bigger cleanup that I'd _really_
like to go in, and I did this trivial one before that much more
interesting one.
diff --git a/refs.c b/refs.c
index 5f80a68..72e2283 100644
--- a/refs.c
+++ b/refs.c
@@ -280,6 +280,12 @@ static int do_for_each_ref(const char *b
}
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;
next prev parent reply other threads:[~2006-09-12 3:10 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-11 19:03 Allow multiple "git_path()" uses Linus Torvalds
2006-09-11 23:37 ` Start handling references internally as a sorted in-memory list Linus Torvalds
2006-09-11 23:50 ` Linus Torvalds
2006-09-11 23:57 ` Junio C Hamano
2006-09-12 1:05 ` Linus Torvalds
2006-09-12 1:09 ` Chris Wedgwood
2006-09-12 3:10 ` Linus Torvalds [this message]
2006-09-12 3:17 ` Make ref resolution saner Linus Torvalds
2006-09-12 5:36 ` Jeff King
2006-09-12 14:41 ` Linus Torvalds
2006-09-18 7:25 ` [RFC] git-pack-refs --prune Junio C Hamano
2006-09-18 16:47 ` Linus Torvalds
2006-09-18 18:44 ` Junio C Hamano
2006-09-21 7:02 ` Junio C Hamano
2006-09-21 7:06 ` [PATCH 1/5] symbolit-ref: fix resolve_ref conversion Junio C Hamano
2006-09-21 7:06 ` [PATCH 2/5] Add callback data to for_each_ref() family Junio C Hamano
2006-09-21 7:06 ` [PATCH 3/5] Tell between packed, unpacked and symbolic refs Junio C Hamano
2006-09-21 7:06 ` [PATCH 4/5] pack-refs: do not pack " Junio C Hamano
2006-09-21 7:06 ` [PATCH 5/5] git-pack-refs --prune Junio C Hamano
2006-09-21 15:19 ` [RFC] " Linus Torvalds
2006-09-22 4:57 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0609112008500.27779@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).