Skip to content

Commit a935ebd

Browse files
mhaggerpeff
authored andcommitted
pack_if_possible_fn(): use ref_type() instead of is_per_worktree_ref()
is_per_worktree_ref() will soon be made private, so use the public interface, ref_type(), in its place. And now that we're using ref_type(), we can make it clear that we won't pack pseudorefs. This was the case before, but due to the not-so-obvious reason that this function is applied to references via the loose reference cache, which only includes references that live inside "refs/". Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Jeff King <[email protected]>
1 parent f4a5721 commit a935ebd

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

refs.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2671,8 +2671,6 @@ struct pack_refs_cb_data {
26712671
struct ref_to_prune *ref_to_prune;
26722672
};
26732673

2674-
static int is_per_worktree_ref(const char *refname);
2675-
26762674
/*
26772675
* An each_ref_entry_fn that is run over loose references only. If
26782676
* the loose reference can be packed, add an entry in the packed ref
@@ -2687,7 +2685,7 @@ static int pack_if_possible_fn(struct ref_entry *entry, void *cb_data)
26872685
int is_tag_ref = starts_with(entry->name, "refs/tags/");
26882686

26892687
/* Do not pack per-worktree refs: */
2690-
if (is_per_worktree_ref(entry->name))
2688+
if (ref_type(entry->name) != REF_TYPE_NORMAL)
26912689
return 0;
26922690

26932691
/* ALWAYS pack tags */

0 commit comments

Comments
 (0)