Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick Stolee <derrickstolee@github.com>2022-08-05 20:58:37 +0300
committerJunio C Hamano <gitster@pobox.com>2022-08-06 00:13:12 +0300
commit97e61e0f9cd96f403504ec97cfdf38f238777560 (patch)
tree2ad031cf850eae3080ada2e74e5aa51ee092048d /environment.c
parentb9342b3fd6308c351f53075c9c4339913b73451f (diff)
refs: use ref_namespaces for replace refs base
The git_replace_ref_base global is used to store the value of the GIT_REPLACE_REF_BASE environment variable or the default of "refs/replace/". This is initialized within setup_git_env(). The ref_namespaces array is a new centralized location for information such as the ref namespace used for replace refs. Instead of having this namespace stored in two places, use the ref_namespaces array instead. For simplicity, create a local git_replace_ref_base variable wherever the global was previously used. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'environment.c')
-rw-r--r--environment.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/environment.c b/environment.c
index 9eb22f975c..b2004437dc 100644
--- a/environment.c
+++ b/environment.c
@@ -56,7 +56,6 @@ const char *askpass_program;
const char *excludes_file;
enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
int read_replace_refs = 1;
-char *git_replace_ref_base;
enum eol core_eol = EOL_UNSET;
int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
char *check_roundtrip_encoding = "SHIFT-JIS";
@@ -162,6 +161,7 @@ const char *getenv_safe(struct strvec *argv, const char *name)
void setup_git_env(const char *git_dir)
{
+ char *git_replace_ref_base;
const char *shallow_file;
const char *replace_ref_base;
struct set_gitdir_args args = { NULL };
@@ -182,7 +182,6 @@ void setup_git_env(const char *git_dir)
if (getenv(NO_REPLACE_OBJECTS_ENVIRONMENT))
read_replace_refs = 0;
replace_ref_base = getenv(GIT_REPLACE_REF_BASE_ENVIRONMENT);
- free(git_replace_ref_base);
git_replace_ref_base = xstrdup(replace_ref_base ? replace_ref_base
: "refs/replace/");
update_ref_namespace(NAMESPACE_REPLACE, git_replace_ref_base);