Thread (51 messages) flat view 51 messages, 6 authors, 2016-06-15
STALE3755d

Revision v6 of 2 in this series.

Revisions (2)
  1. v6 current
  2. v7 [diff vs current]

[PATCH v6 28/32] config: read ref storage config on startup

From: David Turner <hidden>
Date: 2016-06-15 23:08:25
Subsystem: the rest · Maintainer: Linus Torvalds

This sets up the existing backend early, so that other code which
reads refs is reading from the right place.

Signed-off-by: David Turner <redacted>
---
 config.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
diff --git a/config.c b/config.c
index b95ac3a..6cea884 100644
--- a/config.c
+++ b/config.c
@@ -11,6 +11,7 @@
 #include "strbuf.h"
 #include "quote.h"
 #include "hashmap.h"
+#include "refs.h"
 #include "string-list.h"
 #include "utf8.h"
 
@@ -1207,6 +1208,29 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config)
 	}
 
 	if (repo_config && !access_or_die(repo_config, R_OK, 0)) {
+		char *storage = NULL;
+
+		/*
+		 * make sure we always read the ref storage config
+		 * from the extensions section on startup
+		 */
+		ret += git_config_from_file(ref_storage_backend_config,
+					    repo_config, &storage);
+
+		register_ref_storage_backends();
+		if (!storage)
+			storage = xstrdup("");
+
+		if (!*storage ||
+		    !strcmp(storage, "files")) {
+			/* default backend, nothing to do */
+			free(storage);
+		} else {
+			if (set_ref_storage_backend(ref_storage_backend))
+				die(_("Unknown ref storage backend %s"),
+				    ref_storage_backend);
+		}
+
 		ret += git_config_from_file(fn, repo_config, data);
 		found += 1;
 	}
-- 
2.4.2.767.g62658d5-twtrsrc
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help