Skip to content

Commit

Permalink
Add missing inside_work_tree setting in setup_git_directory_gently
Browse files Browse the repository at this point in the history
When both GIT_DIR and GIT_WORK_TREE are set, and
setup_git_directory_gently() changes the current working
directory accordingly, it should also set inside_work_tree = 1.

Without this, work_tree handling code in setup_git_directory()
will be activated. If you stay in root work tree (no prefix),
it does not harm. It does if you work from a subdirectory though.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
pclouds authored and gitster committed Nov 4, 2007
1 parent ee78740 commit 1e8a195
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ const char *setup_git_directory_gently(int *nongit_ok)
if (chdir(work_tree_env) < 0)
die ("Could not chdir to %s", work_tree_env);
strcat(buffer, "/");
inside_work_tree = 1;
return retval;
}
if (nongit_ok) {
Expand Down

0 comments on commit 1e8a195

Please sign in to comment.