Skip to content

Commit 8d3725b

Browse files
mhaggergitster
authored andcommitted
refs: inline function do_not_prune()
Function do_not_prune() was redundantly checking REF_ISSYMREF, which was already tested at the top of pack_one_ref(), so remove that check. And the rest was trivial, so inline the function. Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 12e7755 commit 8d3725b

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

refs.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1996,14 +1996,6 @@ struct pack_refs_cb_data {
19961996
FILE *refs_file;
19971997
};
19981998

1999-
static int do_not_prune(int flags)
2000-
{
2001-
/* If it is already packed or if it is a symref,
2002-
* do not prune it.
2003-
*/
2004-
return (flags & (REF_ISSYMREF|REF_ISPACKED));
2005-
}
2006-
20071999
static int pack_one_ref(struct ref_entry *entry, void *cb_data)
20082000
{
20092001
struct pack_refs_cb_data *cb = cb_data;
@@ -2031,7 +2023,8 @@ static int pack_one_ref(struct ref_entry *entry, void *cb_data)
20312023
sha1_to_hex(o->sha1));
20322024
}
20332025

2034-
if ((cb->flags & PACK_REFS_PRUNE) && !do_not_prune(entry->flag)) {
2026+
/* If the ref was already packed, there is no need to prune it. */
2027+
if ((cb->flags & PACK_REFS_PRUNE) && !(entry->flag & REF_ISPACKED)) {
20352028
int namelen = strlen(entry->name) + 1;
20362029
struct ref_to_prune *n = xcalloc(1, sizeof(*n) + namelen);
20372030
hashcpy(n->sha1, entry->u.value.sha1);

0 commit comments

Comments
 (0)