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

[PATCH 06/11] packfile: add repository argument to reprepare_packed_git

From
Stefan Beller <sbeller@google.com>
Date
Feb 28, 2018, 01:06 UTC
Message-ID
<20180228010608.215505-7-sbeller@google.com>
In-Reply-To
<20180228010608.215505-1-sbeller@google.com>
See previous patch for explanation.
Signed-off-by: Stefan Beller <sbeller@google.com>
---
 builtin/gc.c           | 2 +-
 builtin/receive-pack.c | 3 ++-
 bulk-checkin.c         | 3 ++-
 fetch-pack.c           | 3 ++-
 packfile.c             | 2 +-
 packfile.h             | 3 ++-
 sha1_file.c            | 2 +-
 7 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/builtin/gc.c b/builtin/gc.c
index 97f34ae9fe0..c16020ef42a 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -478,7 +478,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 		return error(FAILED_RUN, rerere.argv[0]);
 
 	report_garbage = report_pack_garbage;
-	reprepare_packed_git();
+	reprepare_packed_git(the_repository);
 	if (pack_garbage.nr > 0)
 		clean_pack_garbage();
 
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 954fc72c7cb..8b03a6e03dc 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1,4 +1,5 @@
 #include "builtin.h"
+#include "repository.h"
 #include "config.h"
 #include "lockfile.h"
 #include "pack.h"
@@ -1778,7 +1779,7 @@ static const char *unpack(int err_fd, struct shallow_info *si)
 		status = finish_command(&child);
 		if (status)
 			return "index-pack abnormal exit";
-		reprepare_packed_git();
+		reprepare_packed_git(the_repository);
 	}
 	return NULL;
 }
diff --git a/bulk-checkin.c b/bulk-checkin.c
index 3310fd210a1..eadc2d51720 100644
--- a/bulk-checkin.c
+++ b/bulk-checkin.c
@@ -3,6 +3,7 @@
  */
 #include "cache.h"
 #include "bulk-checkin.h"
+#include "repository.h"
 #include "csum-file.h"
 #include "pack.h"
 #include "strbuf.h"
@@ -57,7 +58,7 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state)
 
 	strbuf_release(&packname);
 	/* Make objects we just wrote available to ourselves */
-	reprepare_packed_git();
+	reprepare_packed_git(the_repository);
 }
 
 static int already_written(struct bulk_checkin_state *state, unsigned char sha1[])
diff --git a/fetch-pack.c b/fetch-pack.c
index 8253d746e0c..eac5928a27b 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "repository.h"
 #include "config.h"
 #include "lockfile.h"
 #include "refs.h"
@@ -1192,7 +1193,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
 	prepare_shallow_info(&si, shallow);
 	ref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought,
 				&si, pack_lockfile);
-	reprepare_packed_git();
+	reprepare_packed_git(the_repository);
 	update_shallow(args, sought, nr_sought, &si);
 	clear_shallow_info(&si);
 	return ref_cpy;
diff --git a/packfile.c b/packfile.c
index 6e8b98ab405..6ea50230aab 100644
--- a/packfile.c
+++ b/packfile.c
@@ -899,7 +899,7 @@ void prepare_packed_git_the_repository(void)
 	the_repository->objects.packed_git_initialized = 1;
 }
 
-void reprepare_packed_git(void)
+void reprepare_packed_git_the_repository(void)
 {
 	the_repository->objects.approximate_object_count_valid = 0;
 	the_repository->objects.packed_git_initialized = 0;
diff --git a/packfile.h b/packfile.h
index 39eb590b2ae..9afbf73657e 100644
--- a/packfile.h
+++ b/packfile.h
@@ -36,7 +36,8 @@ extern void (*report_garbage)(unsigned seen_bits, const char *path);
 
 #define prepare_packed_git(r) prepare_packed_git_##r()
 extern void prepare_packed_git_the_repository(void);
-extern void reprepare_packed_git(void);
+#define reprepare_packed_git(r) reprepare_packed_git_##r()
+extern void reprepare_packed_git_the_repository(void);
 extern void install_packed_git(struct repository *r, struct packed_git *pack);
 
 /*
diff --git a/sha1_file.c b/sha1_file.c
index 36282acb1a8..0b9fefaaf02 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1281,7 +1281,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,
 			return 0;
 
 		/* Not a loose object; someone else may have just packed it. */
-		reprepare_packed_git();
+		reprepare_packed_git(the_repository);
 		if (find_pack_entry(real, &e))
 			break;
 
-- 
2.16.2.395.g2e18187dfd-goog
Previous: Stefan BellerNext: Stefan Beller
Message 9 of 23 in “Moving global state into the repository object (part 2)”
  1. 00/11 Moving global state into the repository object (part 2)Stefan Beller, Feb 28, 2018
  2. 01/11 packfile: allow prepare_packed_git_mru to handle arbitrary repositoriesStefan Beller, Feb 28, 2018
  3. 02/11 packfile: allow rearrange_packed_git to handle arbitrary repositoriesStefan Beller, Feb 28, 2018
  4. 03/11 packfile: allow install_packed_git to handle arbitrary repositoriesStefan Beller, Feb 28, 2018
  5. Derrick StoleeFeb 28, 2018
  6. 05/11 packfile: add repository argument to prepare_packed_gitStefan Beller, Feb 28, 2018
  7. 07/11 packfile: allow prepare_packed_git_one to handle arbitrary repositoriesStefan Beller, Feb 28, 2018
  8. 08/11 packfile: allow prepare_packed_git to handle arbitrary repositoriesStefan Beller, Feb 28, 2018
  9. 06/11 packfile: add repository argument to reprepare_packed_gitStefan Beller, Feb 28, 2018
  10. 11/11 packfile: allow find_pack_entry to handle arbitrary repositoriesStefan Beller, Feb 28, 2018
  11. 04/11 packfile: add repository argument to prepare_packed_git_oneStefan Beller, Feb 28, 2018
  12. 09/11 packfile: allow reprepare_packed_git to handle arbitrary repositoriesStefan Beller, Feb 28, 2018
  13. 10/11 packfile: add repository argument to find_pack_entryStefan Beller, Feb 28, 2018
  14. Duy NguyenFeb 28, 2018
  15. Derrick StoleeFeb 28, 2018
  16. Junio C HamanoFeb 28, 2018
  17. Stefan BellerFeb 28, 2018
  18. Junio C HamanoFeb 28, 2018
  19. Junio C HamanoFeb 28, 2018
  20. Stefan BellerFeb 28, 2018
  21. Jonathan NiederFeb 28, 2018
  22. Junio C HamanoFeb 28, 2018
  23. Stefan BellerFeb 28, 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.