{"thread":{"id":"44794","subject":"[PATCH] submodule.c: use GIT_DIR_ENVIRONMENT consistently","startedAt":"2016-12-30T00:48:05Z","lastAt":"2017-01-04T01:20:04Z","messageCount":4,"participants":["Stefan Beller","René Scharfe","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"308509","messageId":"20161230004739.19144-1-sbeller@google.com","threadId":"44794","inReplyTo":null,"subject":"[PATCH] submodule.c: use GIT_DIR_ENVIRONMENT consistently","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-12-30T00:47:39Z","receivedAt":"2016-12-30T00:48:05Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"In C code we have the luxury of having constants for all the important\nthings that are hard coded. This is the only place in C, that hard codes\nthe git directory environment variable, so fix it.\n\nSigned-off-by: Stefan Beller <sbeller@google.com>\n---\n  Signed-off-by-the-format-patch-config ;)\n  \n  This is the only occurrence for \"GIT_DIR=\" in C, but what about \".git\"\n  git grep \"\\.git\\\"\" *.c finds some places, which we may want to convert\n  to DEFAULT_GIT_DIR_ENVIRONMENT?\n  (mainly things that are newer if I can judge the places correctly\n  lots of submodules, worktrees and the no data in \".git\" bug AFAICT)\n  \n  Thanks,\n  Stefan\n\n submodule.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/submodule.c b/submodule.c\nindex ece17315d6..973b9f3f96 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -1333,5 +1333,6 @@ void prepare_submodule_repo_env(struct argv_array *out)\n \t\tif (strcmp(*var, CONFIG_DATA_ENVIRONMENT))\n \t\t\targv_array_push(out, *var);\n \t}\n-\targv_array_push(out, \"GIT_DIR=.git\");\n+\targv_array_push(out, \"%s=%s\", GIT_DIR_ENVIRONMENT,\n+\t\tDEFAULT_GIT_DIR_ENVIRONMENT);\n }\n-- \n2.11.0.259.ga95e92af08.dirty\n\n"},{"id":"308512","messageId":"6dd0a31e-d877-5311-37ef-313ed9ab9716@web.de","threadId":"44794","inReplyTo":"20161230004739.19144-1-sbeller@google.com","subject":"Re: [PATCH] submodule.c: use GIT_DIR_ENVIRONMENT consistently","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2016-12-30T01:36:20Z","receivedAt":"2016-12-30T01:36:35Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 30.12.2016 um 01:47 schrieb Stefan Beller:\n> diff --git a/submodule.c b/submodule.c\n> index ece17315d6..973b9f3f96 100644\n> --- a/submodule.c\n> +++ b/submodule.c\n> @@ -1333,5 +1333,6 @@ void prepare_submodule_repo_env(struct argv_array *out)\n>  \t\tif (strcmp(*var, CONFIG_DATA_ENVIRONMENT))\n>  \t\t\targv_array_push(out, *var);\n>  \t}\n> -\targv_array_push(out, \"GIT_DIR=.git\");\n> +\targv_array_push(out, \"%s=%s\", GIT_DIR_ENVIRONMENT,\n> +\t\tDEFAULT_GIT_DIR_ENVIRONMENT);\n\nargv_array_pushf (with added \"f\") instead?\n\nAnd indent continued lines to align them with the left parenthesis, like \nthis:\n\n\tfn(arg1,\n\t   arg2);\n\n>  }\n>\n\n"},{"id":"308711","messageId":"20170103183047.17968-1-sbeller@google.com","threadId":"44794","inReplyTo":"6dd0a31e-d877-5311-37ef-313ed9ab9716@web.de","subject":"[PATCHv2] submodule.c: use GIT_DIR_ENVIRONMENT consistently","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-01-03T18:30:47Z","receivedAt":"2017-01-03T18:33:21Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"In C code we have the luxury of having constants for all the important\nthings that are hard coded. This is the only place in C, that hard codes\nthe git directory environment variable, so fix it.\n\nSigned-off-by: Stefan Beller <sbeller@google.com>\n---\n\nv2:\n  argv_array_pushf and realigned.\n\nv1:\n  Signed-off-by-the-format-patch-config ;)\n  \n  This is the only occurrence for \"GIT_DIR=\" in C, but what about \".git\"\n  git grep \"\\.git\\\"\" *.c finds some places, which we may want to convert\n  to DEFAULT_GIT_DIR_ENVIRONMENT?\n  (mainly things that are newer if I can judge the places correctly\n  lots of submodules, worktrees and the no data in \".git\" bug AFAICT)\n  \n  Thanks,\n  Stefan\n\n submodule.c | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/submodule.c b/submodule.c\nindex ece17315d6..973b9f3f96 100644\n--- a/submodule.c\n+++ b/submodule.c\n@@ -1333,5 +1333,6 @@ void prepare_submodule_repo_env(struct argv_array *out)\n \t\tif (strcmp(*var, CONFIG_DATA_ENVIRONMENT))\n \t\t\targv_array_push(out, *var);\n \t}\n-\targv_array_push(out, \"GIT_DIR=.git\");\n+\targv_array_pushf(out, \"%s=%s\", GIT_DIR_ENVIRONMENT,\n+\t\t\t DEFAULT_GIT_DIR_ENVIRONMENT);\n }\n-- \n2.11.0.259.ga95e92af08.dirty\n\n"},{"id":"308755","messageId":"20170104011841.bpoiqvi5hqsdqu7y@sigill.intra.peff.net","threadId":"44794","inReplyTo":"20170103183047.17968-1-sbeller@google.com","subject":"Re: [PATCHv2] submodule.c: use GIT_DIR_ENVIRONMENT consistently","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-01-04T01:18:41Z","receivedAt":"2017-01-04T01:20:04Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Jan 03, 2017 at 10:30:47AM -0800, Stefan Beller wrote:\n\n> In C code we have the luxury of having constants for all the important\n> things that are hard coded. This is the only place in C, that hard codes\n> the git directory environment variable, so fix it.\n> \n> Signed-off-by: Stefan Beller <sbeller@google.com>\n\nThis looks like a good change to me.\n\nMinor nit: the comma after \"C\" in your commit message is extraneous. ;)\n\n-Peff\n"}]}