Thread (103 messages) flat view 103 messages, 6 authors, 2018-02-28

Re: [PATCH v2 3/4] sha1_file.c: move delayed getenv(altdb) back to setup_git_env()

From: Duy Nguyen <hidden>
Date: 2018-02-28 00:59:13

On Wed, Feb 28, 2018 at 3:12 AM, Brandon Williams [off-list ref] wrote:
On 02/27, Nguyễn Thái Ngọc Duy wrote:
quoted
diff --git a/repository.c b/repository.c
index 7654b8ada9..e326f0fcbc 100644
--- a/repository.c
+++ b/repository.c
@@ -61,6 +61,8 @@ void repo_set_gitdir(struct repository *repo,
      repo_set_commondir(repo, o->shared_root);
      expand_base_dir(&repo->objects.objectdir, o->object_dir,
                      repo->commondir, "objects");
+     free(repo->objects.alternate_db);
+     repo->objects.alternate_db = xstrdup_or_null(o->alternate_db);
Just a note that this only works because the object store is embedded in
the repository struct, it isn't a pointer to an object store.
It is possible to make it work even if object store is not embedded
though. From my point of view, this function is about "give me
$GIT_DIR and optionally the where all other parts are, if you ignore
default repo layout and tear the repository apart". We could
initialize the object store later when it's created and pass the
relevant paths to it. Exactly where it's safe to "create and
initialize object store" is harder to see now because the whole main
repo setup is spread out over many many functions.
-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help