pack-check.c: remove the_repository references
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Nov 10, 2018 at 06:49 UTC
94e10825bd72660548956a6d5fb260642ffb6386
3 files changed
+10
-6
builtin/fsck.c
+2
-1
@@ -752,7 +752,8 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
752
for (p = get_all_packs(the_repository); p;
753
p = p->next) {
754
/* verify gives error messages itself */
755
- if (verify_pack(p, fsck_obj_buffer,
755
+ if (verify_pack(the_repository,
756
+ p, fsck_obj_buffer,
757
progress, count))
758
errors_found |= ERROR_PACK;
759
count += p->num_objects;
pack-check.c
+5
-4
@@ -48,7 +48,8 @@ int check_pack_crc(struct packed_git *p, struct pack_window **w_curs,
48
return data_crc != ntohl(*index_crc);
49
}
50
51
-static int verify_packfile(struct packed_git *p,
51
+static int verify_packfile(struct repository *r,
52
+ struct packed_git *p,
53
struct pack_window **w_curs,
54
verify_fn fn,
55
struct progress *progress, uint32_t base_count)
@@ -135,7 +136,7 @@ static int verify_packfile(struct packed_git *p,
136
data = NULL;
137
data_valid = 0;
138
} else {
138
- data = unpack_entry(the_repository, p, entries[i].offset, &type, &size);
139
+ data = unpack_entry(r, p, entries[i].offset, &type, &size);
140
data_valid = 1;
141
}
142
@@ -186,7 +187,7 @@ int verify_pack_index(struct packed_git *p)
187
return err;
188
}
189
189
-int verify_pack(struct packed_git *p, verify_fn fn,
190
+int verify_pack(struct repository *r, struct packed_git *p, verify_fn fn,
191
struct progress *progress, uint32_t base_count)
192
{
193
int err = 0;
@@ -196,7 +197,7 @@ int verify_pack(struct packed_git *p, verify_fn fn,
197
if (!p->index_data)
198
return -1;
199
199
- err |= verify_packfile(p, &w_curs, fn, progress, base_count);
200
+ err |= verify_packfile(r, p, &w_curs, fn, progress, base_count);
201
unuse_pack(&w_curs);
202
203
return err;
pack.h
+3
-1
@@ -4,6 +4,8 @@
4
#include "object.h"
5
#include "csum-file.h"
6
7
+struct repository;
8
+
9
/*
10
* Packed object header
11
*/
@@ -80,7 +82,7 @@ typedef int (*verify_fn)(const struct object_id *, enum object_type, unsigned lo
82
extern const char *write_idx_file(const char *index_name, struct pack_idx_entry **objects, int nr_objects, const struct pack_idx_option *, const unsigned char *sha1);
83
extern int check_pack_crc(struct packed_git *p, struct pack_window **w_curs, off_t offset, off_t len, unsigned int nr);
84
extern int verify_pack_index(struct packed_git *);
83
-extern int verify_pack(struct packed_git *, verify_fn fn, struct progress *, uint32_t);
85
+extern int verify_pack(struct repository *, struct packed_git *, verify_fn fn, struct progress *, uint32_t);
86
extern off_t write_pack_header(struct hashfile *f, uint32_t);
87
extern void fixup_pack_header_footer(int, unsigned char *, const char *, uint32_t, unsigned char *, off_t);
88
extern char *index_pack_lockfile(int fd);