const unsigned char *sha1;
struct object *o;
- for (i = 0; i < revs->num_ignore_packed; i++) {
- if (matches_pack_name(p, revs->ignore_packed[i]))
- break;
- }
- if (revs->num_ignore_packed <= i)
+ if (is_kept_pack(p, revs))
continue;
if (open_pack_index(p))
die("cannot open pack index");
const unsigned char *sha1;
for (p = packed_git; p; p = p->next) {
- for (i = 0; i < revs->num_ignore_packed; i++) {
- if (matches_pack_name(p, revs->ignore_packed[i]))
- break;
- }
- if (revs->num_ignore_packed <= i)
+ if (is_kept_pack(p, revs))
continue;
if (open_pack_index(p))
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 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 */
extern int update_server_info(int);
extern enum commit_action simplify_commit(struct rev_info *revs, struct commit *commit);
extern int has_sha1_kept_pack(const unsigned char *sha1, const struct rev_info *);
+extern int is_kept_pack(const struct packed_git *, const struct rev_info *);
#endif
return 0;
}
-int matches_pack_name(struct packed_git *p, const char *name)
+static int matches_pack_name(const struct packed_git *p, const char *name)
{
const char *last_c, *c;
return 0;
}
+int is_kept_pack(const struct packed_git *p, const struct rev_info *revs)
+{
+ int i;
+
+ for (i = 0; i < revs->num_ignore_packed; i++) {
+ if (matches_pack_name(p, revs->ignore_packed[i]))
+ return 0;
+ }
+ return 1;
+}
+
static int find_pack_ent(const unsigned char *sha1, struct pack_entry *e,
const struct rev_info *revs)
{
p = (last_found == (void *)1) ? packed_git : last_found;
do {
- if (revs->ignore_packed) {
- const char **ig;
- for (ig = revs->ignore_packed; *ig; ig++)
- if (matches_pack_name(p, *ig))
- break;
- if (*ig)
- goto next;
- }
-
+ if (revs->ignore_packed && !is_kept_pack(p, revs))
+ goto next;
if (p->num_bad_objects) {
unsigned i;
for (i = 0; i < p->num_bad_objects; i++)