[PATCH 158/194] commit: allow prepare_commit_graft to handle arbitrary repositories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx>
---
 commit.c | 14 ++++++--------
 object.h |  3 +++
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/commit.c b/commit.c
index 63dac3e601..fcda65bee2 100644
--- a/commit.c
+++ b/commit.c
@@ -197,19 +197,17 @@ static int read_graft_file(struct repository *r, const char *graft_file)
 	return 0;
 }
 
-#define prepare_commit_graft(r) prepare_commit_graft_##r()
-static void prepare_commit_graft_the_repository(void)
+static void prepare_commit_graft(struct repository *r)
 {
-	static int commit_graft_prepared;
 	char *graft_file;
 
-	if (commit_graft_prepared)
+	if (r->parsed_objects.commit_graft_prepared)
 		return;
-	graft_file = get_graft_file(the_repository);
-	read_graft_file(the_repository, graft_file);
+	graft_file = get_graft_file(r);
+	read_graft_file(r, graft_file);
 	/* make sure shallows are read */
-	is_repository_shallow(the_repository);
-	commit_graft_prepared = 1;
+	is_repository_shallow(r);
+	r->parsed_objects.commit_graft_prepared = 1;
 }
 
 struct commit_graft *lookup_commit_graft_the_repository(const struct object_id *oid)
diff --git a/object.h b/object.h
index 369295c7c1..14e0d412bb 100644
--- a/object.h
+++ b/object.h
@@ -11,6 +11,8 @@ struct object_parser {
 	struct commit_graft **grafts;
 	int grafts_alloc, grafts_nr;
 
+	int commit_graft_prepared;
+
 	int is_shallow;
 	struct stat_validity *shallow_stat;
 	char *alternate_shallow_file;
@@ -32,6 +34,7 @@ extern struct alloc_state the_repository_tag_state;
 extern struct alloc_state the_repository_object_state;
 #define OBJECT_PARSER_INIT { NULL, 0, 0, &the_repository_buffer_slab, \
 	NULL, 0, 0, \
+	0, \
 	-1, &the_repository_shallow_stat, NULL, \
 	&the_repository_blob_state, \
 	&the_repository_tree_state, \
-- 
2.15.1.433.g936d1b9894.dirty




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux