Skip to content

Commit

Permalink
pack_one_ref(): do some cheap tests before a more expensive one
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed May 1, 2013
1 parent 0f29920 commit b2a8226
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down

0 comments on commit b2a8226

Please sign in to comment.