diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2013-04-22 21:52:39 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-05-02 00:33:11 +0200 |
commit | b2a8226d6360fc6e19af134236b3dd11f9d2040e (patch) | |
tree | 7441557c88480667662983d5ecf580693f9971b0 /refs.c | |
parent | pack_one_ref(): use write_packed_entry() to do the writing (diff) | |
download | git-b2a8226d6360fc6e19af134236b3dd11f9d2040e.tar.xz git-b2a8226d6360fc6e19af134236b3dd11f9d2040e.zip |
pack_one_ref(): do some cheap tests before a more expensive one
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r-- | refs.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -2008,18 +2008,17 @@ static int pack_one_ref(struct ref_entry *entry, void *cb_data) { struct pack_refs_cb_data *cb = cb_data; enum peel_status peel_status; - int is_tag_ref; - - /* Do not pack symbolic or broken refs: */ - if ((entry->flag & REF_ISSYMREF) || !ref_resolves_to_object(entry)) - return 0; - is_tag_ref = !prefixcmp(entry->name, "refs/tags/"); + int is_tag_ref = !prefixcmp(entry->name, "refs/tags/"); /* ALWAYS pack refs that were already packed or are tags */ if (!(cb->flags & PACK_REFS_ALL) && !is_tag_ref && !(entry->flag & REF_ISPACKED)) return 0; + /* Do not pack symbolic or broken refs: */ + if ((entry->flag & REF_ISSYMREF) || !ref_resolves_to_object(entry)) + return 0; + peel_status = peel_entry(entry, 1); if (peel_status != PEEL_PEELED && peel_status != PEEL_NON_TAG) die("internal error peeling reference %s (%s)", |