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

Re: [PATCH] Revert "setup: set env $GIT_WORK_TREE when work tree is set, like $GIT_DIR"

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 21, 2015, 17:28 UTC
Message-ID
<xmqqegefhftq.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<1450693372-6863-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
Show 16 quoted lines
> This commit has caused three regression reports so far. All of them are
> about spawning git subprocesses, where the new presence of GIT_WORK_TREE
> either changes command behaviour (git-init or git-clone), or how
> repo/worktree is detected (from aliases), with or without $GIT_DIR.
> The original bug will be re-fixed another way.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  On Thu, Dec 3, 2015 at 12:09 AM, Junio C Hamano <gitster@pobox.com> wrote:
>  > OK, when/if you decide that our first step should be a revert of
>  > d95138e please send in a patch to do so with a brief write-up of a
>  > follow-up plan.
>
>  Three reports to me are enough. And I obviously could not push the
>  fix out fast enough. So if you want to revert it, here's the patch on
>  maint.

The timing of this is a bit unfortunate, as d95138e is a regression since v2.5.1 throughout v2.6 series. I'll push this out on maint and onwards for now. I do not think we added new things that rely on the post-d95138e "broken" behaviour in-tree, but this reversion might introduce another unexpected regression X-<. We'll see.

Thanks.
Show 31 quoted lines
>
>  environment.c      | 2 --
>  t/t0002-gitfile.sh | 2 +-
>  2 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/environment.c b/environment.c
> index 23a38e4..f1a2a49 100644
> --- a/environment.c
> +++ b/environment.c
> @@ -238,8 +238,6 @@ void set_git_work_tree(const char *new_work_tree)
>  	}
>  	git_work_tree_initialized = 1;
>  	work_tree = xstrdup(real_path(new_work_tree));
> -	if (setenv(GIT_WORK_TREE_ENVIRONMENT, work_tree, 1))
> -		die("could not set GIT_WORK_TREE to '%s'", work_tree);
>  }
>  
>  const char *get_git_work_tree(void)
> diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh
> index 9670e8c..3afe012 100755
> --- a/t/t0002-gitfile.sh
> +++ b/t/t0002-gitfile.sh
> @@ -99,7 +99,7 @@ test_expect_success 'check rev-list' '
>  	test "$SHA" = "$(git rev-list HEAD)"
>  '
>  
> -test_expect_success 'setup_git_dir twice in subdir' '
> +test_expect_failure 'setup_git_dir twice in subdir' '
>  	git init sgd &&
>  	(
>  		cd sgd &&
Previous: Nguyễn Thái Ngọc DuyNext: Junio C Hamano
Message 36 of 39 in “Fwd: Git clone fails during pre-commit hook due to GIT_WORK_TREE=. (regression 2.5 -> 2.6)”
  1. Anthony SottileNov 24, 2015
  2. Stefan BellerNov 24, 2015
  3. Duy NguyenNov 25, 2015
  4. Duy NguyenNov 30, 2015
  5. Junio C HamanoNov 30, 2015
  6. Duy NguyenDec 1, 2015
  7. Junio C HamanoDec 2, 2015
  8. 1/2 git.c: make it clear save_env() is for alias handling onlyNguyễn Thái Ngọc Duy, Dec 3, 2015
  9. 2/2 setup.c: re-fix d95138e (setup: set env $GIT_WORK_TREE when ..Nguyễn Thái Ngọc Duy, Dec 3, 2015
  10. Junio C HamanoDec 4, 2015
  11. Duy NguyenDec 5, 2015
  12. 3/2 git.c: make sure we do not leak GIT_* to alias scriptsNguyễn Thái Ngọc Duy, Dec 5, 2015
  13. Junio C HamanoDec 7, 2015
  14. Duy NguyenDec 8, 2015
  15. Jeff KingDec 8, 2015
  16. Junio C HamanoDec 8, 2015
  17. Duy NguyenDec 5, 2015
  18. Junio C HamanoDec 7, 2015
  19. 0/3 nd/clear-gitenv-upon-use-of-aliasNguyễn Thái Ngọc Duy, Dec 20, 2015
  20. 1/3 git.c: make it clear save_env() is for alias handling onlyNguyễn Thái Ngọc Duy, Dec 20, 2015
  21. 2/3 setup.c: re-fix d95138e (setup: set env $GIT_WORK_TREE when ..Nguyễn Thái Ngọc Duy, Dec 20, 2015
  22. 3/3 git.c: make sure we do not leak GIT_* to alias scriptsNguyễn Thái Ngọc Duy, Dec 20, 2015
  23. Junio C HamanoDec 21, 2015
  24. Duy NguyenDec 22, 2015
  25. Duy NguyenDec 22, 2015
  26. Junio C HamanoDec 22, 2015
  27. Jeff KingDec 23, 2015
  28. Duy NguyenDec 23, 2015
  29. Eric SunshineDec 23, 2015
  30. Johannes SixtDec 23, 2015
  31. Jeff KingDec 23, 2015
  32. Duy NguyenDec 24, 2015
  33. Jeff KingDec 29, 2015
  34. Junio C HamanoDec 29, 2015
  35. Revert "setup: set env $GIT_WORK_TREE when work tree is set, like $GIT_DIR"Nguyễn Thái Ngọc Duy, Dec 21, 2015
  36. Junio C HamanoDec 21, 2015
  37. Junio C HamanoDec 21, 2015
  38. Duy NguyenDec 22, 2015
  39. Junio C HamanoDec 22, 2015

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.