git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] submodule.c: use GIT_DIR_ENVIRONMENT consistently

From
Stefan Beller <sbeller@google.com>
Date
Dec 30, 2016, 00:47 UTC
Message-ID
<20161230004739.19144-1-sbeller@google.com>

In C code we have the luxury of having constants for all the important things that are hard coded. This is the only place in C, that hard codes the git directory environment variable, so fix it.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
  Signed-off-by-the-format-patch-config ;)
  
  This is the only occurrence for "GIT_DIR=" in C, but what about ".git"
  git grep "\.git\"" *.c finds some places, which we may want to convert
  to DEFAULT_GIT_DIR_ENVIRONMENT?
  (mainly things that are newer if I can judge the places correctly
  lots of submodules, worktrees and the no data in ".git" bug AFAICT)
  
  Thanks,
  Stefan
 submodule.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/submodule.c b/submodule.c
index ece17315d6..973b9f3f96 100644
--- a/submodule.c
+++ b/submodule.c
@@ -1333,5 +1333,6 @@ void prepare_submodule_repo_env(struct argv_array *out)
 		if (strcmp(*var, CONFIG_DATA_ENVIRONMENT))
 			argv_array_push(out, *var);
 	}
-	argv_array_push(out, "GIT_DIR=.git");
+	argv_array_push(out, "%s=%s", GIT_DIR_ENVIRONMENT,
+		DEFAULT_GIT_DIR_ENVIRONMENT);
 }
-- 
2.11.0.259.ga95e92af08.dirty
Next: René Scharfe
Message 1 of 4 in “submodule.c: use GIT_DIR_ENVIRONMENT consistently”
  1. submodule.c: use GIT_DIR_ENVIRONMENT consistentlyStefan Beller, Dec 30, 2016
  2. René ScharfeDec 30, 2016
  3. [PATCHv2] submodule.c: use GIT_DIR_ENVIRONMENT consistentlyStefan Beller, Jan 3, 2017
  4. Jeff KingJan 4, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.