Thread (42 messages) 42 messages, 4 authors, 4d ago

Re: [PATCH 07/13] setup: move prefix into repository

From: Justin Tobler <hidden>
Date: 2026-07-06 22:33:40

On 26/06/30 01:47PM, Patrick Steinhardt wrote:
The repository prefix is currently stored in the startup info. This
feels somewhat awkward though, as it is inherently a property of a given
repository.
Agreed.
Move the prefix into the repository accordingly.

Signed-off-by: Patrick Steinhardt <redacted>
---
[snip]
quoted hunk ↗ jump to hunk
@@ -832,7 +832,8 @@ int cmd_rev_parse(int argc,
 				prefix = argv[++i];
 				if (!prefix)
 					die(_("--prefix requires an argument"));
-				startup_info->prefix = prefix;
+				FREE_AND_NULL(the_repository->prefix);
+				the_repository->prefix = xstrdup(prefix);
git-rev-parse(1) has an option to explicitly set the prefix and we honor
that here.

[snip]
quoted hunk ↗ jump to hunk
@@ -2105,10 +2105,10 @@ const char *setup_git_directory_gently(struct repository *repo, int *nongit_ok)
 	 */
 	if (prefix) {
 		prefix = precompose_string_if_needed(prefix);
-		startup_info->prefix = prefix;
+		repo->prefix = xstrdup(prefix);
 		setenv(GIT_PREFIX_ENVIRONMENT, prefix, 1);
 	} else {
-		startup_info->prefix = NULL;
+		FREE_AND_NULL(repo->prefix);
 		setenv(GIT_PREFIX_ENVIRONMENT, "", 1);
 	}
We set the startup_info prefix here is `setup_git_directory_gently()`
aleady, so we might as well just set it in the repository. I think this
is a good change.

-Justin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help