1
0
mirror of https://github.com/git/git.git synced 2024-10-02 04:11:36 +02:00

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>
This commit is contained in:
Junio C Hamano 2007-09-16 23:15:19 -07:00
parent d4bb43ee27
commit 000dfd3f6e
2 changed files with 8 additions and 7 deletions

@ -529,6 +529,7 @@ extern void *unpack_entry(struct packed_git *, off_t, enum object_type *, unsign
extern unsigned long unpack_object_header_gently(const unsigned char *buf, unsigned long len, enum object_type *type, unsigned long *sizep); extern unsigned long unpack_object_header_gently(const unsigned char *buf, unsigned long len, enum object_type *type, unsigned long *sizep);
extern unsigned long get_size_from_delta(struct packed_git *, struct pack_window **, off_t); extern unsigned long get_size_from_delta(struct packed_git *, struct pack_window **, off_t);
extern const char *packed_object_info_detail(struct packed_git *, off_t, unsigned long *, unsigned long *, unsigned int *, unsigned char *); extern const char *packed_object_info_detail(struct packed_git *, off_t, unsigned long *, unsigned long *, unsigned int *, unsigned char *);
extern int matches_pack_name(struct packed_git *p, const char *name);
/* Dumb servers support */ /* Dumb servers support */
extern int update_server_info(int); extern int update_server_info(int);

@ -1684,22 +1684,22 @@ off_t find_pack_entry_one(const unsigned char *sha1,
return 0; return 0;
} }
static int matches_pack_name(struct packed_git *p, const char *ig) int matches_pack_name(struct packed_git *p, const char *name)
{ {
const char *last_c, *c; const char *last_c, *c;
if (!strcmp(p->pack_name, ig)) if (!strcmp(p->pack_name, name))
return 0; return 1;
for (c = p->pack_name, last_c = c; *c;) for (c = p->pack_name, last_c = c; *c;)
if (*c == '/') if (*c == '/')
last_c = ++c; last_c = ++c;
else else
++c; ++c;
if (!strcmp(last_c, ig)) if (!strcmp(last_c, name))
return 0; return 1;
return 1; return 0;
} }
static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e, const char **ignore_packed) 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
if (ignore_packed) { if (ignore_packed) {
const char **ig; const char **ig;
for (ig = ignore_packed; *ig; ig++) for (ig = ignore_packed; *ig; ig++)
if (!matches_pack_name(p, *ig)) if (matches_pack_name(p, *ig))
break; break;
if (*ig) if (*ig)
goto next; goto next;