git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 19/22] pack-check.c: remove the_repository references

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Nov 10, 2018, 05:49 UTC
Message-ID
<20181110054910.10568-20-pclouds@gmail.com>
In-Reply-To
<20181110054910.10568-1-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/fsck.c | 3 ++-
 pack-check.c   | 9 +++++----
 pack.h         | 4 +++-
 3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/builtin/fsck.c b/builtin/fsck.c
index 06eb421720..8ea2823864 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -752,7 +752,8 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
 			for (p = get_all_packs(the_repository); p;
 			     p = p->next) {
 				/* verify gives error messages itself */
-				if (verify_pack(p, fsck_obj_buffer,
+				if (verify_pack(the_repository,
+						p, fsck_obj_buffer,
 						progress, count))
 					errors_found |= ERROR_PACK;
 				count += p->num_objects;
diff --git a/pack-check.c b/pack-check.c
index fa5f0ff8fa..2cc3603189 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -48,7 +48,8 @@ int check_pack_crc(struct packed_git *p, struct pack_window **w_curs,
 	return data_crc != ntohl(*index_crc);
 }
 
-static int verify_packfile(struct packed_git *p,
+static int verify_packfile(struct repository *r,
+			   struct packed_git *p,
 			   struct pack_window **w_curs,
 			   verify_fn fn,
 			   struct progress *progress, uint32_t base_count)
@@ -135,7 +136,7 @@ static int verify_packfile(struct packed_git *p,
 			data = NULL;
 			data_valid = 0;
 		} else {
-			data = unpack_entry(the_repository, p, entries[i].offset, &type, &size);
+			data = unpack_entry(r, p, entries[i].offset, &type, &size);
 			data_valid = 1;
 		}
 
@@ -186,7 +187,7 @@ int verify_pack_index(struct packed_git *p)
 	return err;
 }
 
-int verify_pack(struct packed_git *p, verify_fn fn,
+int verify_pack(struct repository *r, struct packed_git *p, verify_fn fn,
 		struct progress *progress, uint32_t base_count)
 {
 	int err = 0;
@@ -196,7 +197,7 @@ int verify_pack(struct packed_git *p, verify_fn fn,
 	if (!p->index_data)
 		return -1;
 
-	err |= verify_packfile(p, &w_curs, fn, progress, base_count);
+	err |= verify_packfile(r, p, &w_curs, fn, progress, base_count);
 	unuse_pack(&w_curs);
 
 	return err;
diff --git a/pack.h b/pack.h
index 34a9d458b4..da99fdd1d2 100644
--- a/pack.h
+++ b/pack.h
@@ -4,6 +4,8 @@
 #include "object.h"
 #include "csum-file.h"
 
+struct repository;
+
 /*
  * Packed object header
  */
@@ -80,7 +82,7 @@ typedef int (*verify_fn)(const struct object_id *, enum object_type, unsigned lo
 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);
 extern int check_pack_crc(struct packed_git *p, struct pack_window **w_curs, off_t offset, off_t len, unsigned int nr);
 extern int verify_pack_index(struct packed_git *);
-extern int verify_pack(struct packed_git *, verify_fn fn, struct progress *, uint32_t);
+extern int verify_pack(struct repository *, struct packed_git *, verify_fn fn, struct progress *, uint32_t);
 extern off_t write_pack_header(struct hashfile *f, uint32_t);
 extern void fixup_pack_header_footer(int, unsigned char *, const char *, uint32_t, unsigned char *, off_t);
 extern char *index_pack_lockfile(int fd);
-- 
2.19.1.1231.g84aef82467
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 16 of 24 in “Kill the_index part 5”
  1. 00/22 Kill the_index part 5Nguyễn Thái Ngọc Duy, Nov 10, 2018
  2. 01/22 wt-status.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Nov 10, 2018
  3. 03/22 list-objects-filter.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Nov 10, 2018
  4. 04/22 list-objects.c: reduce the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  5. 05/22 notes-merge.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Nov 10, 2018
  6. 06/22 notes-merge.c: remove implicit dependency the_repositoryNguyễn Thái Ngọc Duy, Nov 10, 2018
  7. 07/22 transport.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Nov 10, 2018
  8. 08/22 sequencer.c: remove implicit dependency on the_indexNguyễn Thái Ngọc Duy, Nov 10, 2018
  9. 09/22 sequencer.c: remove implicit dependency on the_repositoryNguyễn Thái Ngọc Duy, Nov 10, 2018
  10. 11/22 bisect.c: remove the_repository referenceNguyễn Thái Ngọc Duy, Nov 10, 2018
  11. 12/22 branch.c: remove the_repository referenceNguyễn Thái Ngọc Duy, Nov 10, 2018
  12. 14/22 cache-tree.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  13. 15/22 delta-islands.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  14. 17/22 line-log.c: remove the_repository referenceNguyễn Thái Ngọc Duy, Nov 10, 2018
  15. 18/22 notes-cache.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  16. 19/22 pack-check.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  17. 20/22 pack-*.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  18. 21/22 rerere.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  19. 22/22 rebase-interactive.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  20. 16/22 diff-lib.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  21. 13/22 bundle.c: remove the_repository referencesNguyễn Thái Ngọc Duy, Nov 10, 2018
  22. 10/22 blame.c: remove implicit dependency the_repositoryNguyễn Thái Ngọc Duy, Nov 10, 2018
  23. 02/22 wt-status.c: remove implicit dependency the_repositoryNguyễn Thái Ngọc Duy, Nov 10, 2018
  24. Junio C HamanoNov 12, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.