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>
Junio C Hamano committed
Sep 16, 2007 at 23:15 UTC
000dfd3f6e3f61e15ccfd4cecb3a51624adfbf38
2 files changed
+8
-7
cache.h
+1
@@ -529,6 +529,7 @@ extern void *unpack_entry(struct packed_git *, off_t, enum object_type *, unsign
529
extern unsigned long unpack_object_header_gently(const unsigned char *buf, unsigned long len, enum object_type *type, unsigned long *sizep);
530
extern unsigned long get_size_from_delta(struct packed_git *, struct pack_window **, off_t);
531
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);
533
534
/* Dumb servers support */
535
extern int update_server_info(int);
sha1_file.c
+7
-7
@@ -1684,22 +1684,22 @@ off_t find_pack_entry_one(const unsigned char *sha1,
1684
return 0;
1685
}
1686
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)
1688
{
1689
const char *last_c, *c;
1690
1691
- if (!strcmp(p->pack_name, ig))
1692
- return 0;
1691
+ if (!strcmp(p->pack_name, name))
1692
+ return 1;
1693
1694
for (c = p->pack_name, last_c = c; *c;)
1695
if (*c == '/')
1696
last_c = ++c;
1697
else
1698
++c;
1699
- if (!strcmp(last_c, ig))
1700
- return 0;
1699
+ if (!strcmp(last_c, name))
1700
+ return 1;
1701
1702
- return 1;
1702
+ return 0;
1703
}
1704
1705
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
1717
if (ignore_packed) {
1718
const char **ig;
1719
for (ig = ignore_packed; *ig; ig++)
1720
- if (!matches_pack_name(p, *ig))
1720
+ if (matches_pack_name(p, *ig))
1721
break;
1722
if (*ig)
1723
goto next;