git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] submodule.c: use GIT_DIR_ENVIRONMENT consistently
@ 2016-12-30  0:47 Stefan Beller
  2016-12-30  1:36 ` René Scharfe
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Beller @ 2016-12-30  0:47 UTC (permalink / raw)
  To: gitster, jrnieder; +Cc: git, Stefan Beller

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-01-04  1:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-30  0:47 [PATCH] submodule.c: use GIT_DIR_ENVIRONMENT consistently Stefan Beller
2016-12-30  1:36 ` René Scharfe
2017-01-03 18:30   ` [PATCHv2] " Stefan Beller
2017-01-04  1:18     ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).