Skip to content

Commit 000dfd3

Browse files
committed
Export matches_pack_name() and fix its return value
The function sounds boolean; make it behave as one, not "0 for success, non-zero for failure". Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent d4bb43e commit 000dfd3

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ extern void *unpack_entry(struct packed_git *, off_t, enum object_type *, unsign
529529
extern unsigned long unpack_object_header_gently(const unsigned char *buf, unsigned long len, enum object_type *type, unsigned long *sizep);
530530
extern unsigned long get_size_from_delta(struct packed_git *, struct pack_window **, off_t);
531531
extern const char *packed_object_info_detail(struct packed_git *, off_t, unsigned long *, unsigned long *, unsigned int *, unsigned char *);
532+
extern int matches_pack_name(struct packed_git *p, const char *name);
532533

533534
/* Dumb servers support */
534535
extern int update_server_info(int);

sha1_file.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,22 +1684,22 @@ off_t find_pack_entry_one(const unsigned char *sha1,
16841684
return 0;
16851685
}
16861686

1687-
static int matches_pack_name(struct packed_git *p, const char *ig)
1687+
int matches_pack_name(struct packed_git *p, const char *name)
16881688
{
16891689
const char *last_c, *c;
16901690

1691-
if (!strcmp(p->pack_name, ig))
1692-
return 0;
1691+
if (!strcmp(p->pack_name, name))
1692+
return 1;
16931693

16941694
for (c = p->pack_name, last_c = c; *c;)
16951695
if (*c == '/')
16961696
last_c = ++c;
16971697
else
16981698
++c;
1699-
if (!strcmp(last_c, ig))
1700-
return 0;
1699+
if (!strcmp(last_c, name))
1700+
return 1;
17011701

1702-
return 1;
1702+
return 0;
17031703
}
17041704

17051705
static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e, const char **ignore_packed)
@@ -1717,7 +1717,7 @@ static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e, cons
17171717
if (ignore_packed) {
17181718
const char **ig;
17191719
for (ig = ignore_packed; *ig; ig++)
1720-
if (!matches_pack_name(p, *ig))
1720+
if (matches_pack_name(p, *ig))
17211721
break;
17221722
if (*ig)
17231723
goto next;

0 commit comments

Comments
 (0)