summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2013-04-22 21:52:36 +0200
committerJunio C Hamano <gitster@pobox.com>2013-05-01 15:33:11 -0700
commit8d3725b96fa6878fabe5ec715ff7b9f263481ea1 (patch)
tree9b7f368375aa766012aef6b1da5b6bacb262444f /refs.c
parent12e77559ec4bf863d3703a25ab79298d5ff89b3b (diff)
downloadgit-8d3725b96fa6878fabe5ec715ff7b9f263481ea1.tar.gz
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 <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/refs.c b/refs.c
index 3465db64f9..b1c15fda80 100644
--- a/refs.c
+++ b/refs.c
@@ -1996,14 +1996,6 @@ struct pack_refs_cb_data {
FILE *refs_file;
};
-static int do_not_prune(int flags)
-{
- /* If it is already packed or if it is a symref,
- * do not prune it.
- */
- return (flags & (REF_ISSYMREF|REF_ISPACKED));
-}
-
static int pack_one_ref(struct ref_entry *entry, void *cb_data)
{
struct pack_refs_cb_data *cb = cb_data;
@@ -2031,7 +2023,8 @@ static int pack_one_ref(struct ref_entry *entry, void *cb_data)
sha1_to_hex(o->sha1));
}
- if ((cb->flags & PACK_REFS_PRUNE) && !do_not_prune(entry->flag)) {
+ /* If the ref was already packed, there is no need to prune it. */
+ if ((cb->flags & PACK_REFS_PRUNE) && !(entry->flag & REF_ISPACKED)) {
int namelen = strlen(entry->name) + 1;
struct ref_to_prune *n = xcalloc(1, sizeof(*n) + namelen);
hashcpy(n->sha1, entry->u.value.sha1);