]> git.ipfire.org Git - thirdparty/git.git/commit - config.c
read_early_config(): really discover .git/
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 13 Mar 2017 20:11:12 +0000 (21:11 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 14 Mar 2017 21:24:16 +0000 (14:24 -0700)
commit1a27409ae81120c1f2d8e6983b58a53293265491
treea276ddbeffaece9a036ebd9671f9b395f5720c84
parent267b4538c0e13f98870bf808ee6c71fca9cf2ef7
read_early_config(): really discover .git/

Earlier, we punted and simply assumed that we are in the top-level
directory of the project, and that there is no .git file but a .git/
directory so that we can read directly from .git/config.

However, that is not necessarily true. We may be in a subdirectory. Or
.git may be a gitfile. Or the environment variable GIT_DIR may be set.

To remedy this situation, we just refactored the way
setup_git_directory() discovers the .git/ directory, to make it
reusable, and more importantly, to leave all global variables and the
current working directory alone.

Let's discover the .git/ directory correctly in read_early_config() by
using that new function.

This fixes 4 known breakages in t7006.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.c
t/t7006-pager.sh