]> git.ipfire.org Git - thirdparty/git.git/commit - setup.c
setup: prepare setup_discovered_git_dir() for the root directory
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 13 Mar 2017 20:09:44 +0000 (21:09 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 14 Mar 2017 21:24:04 +0000 (14:24 -0700)
commitdf380d58ece2a745e4283ef4de8dfeea560546bb
tree87af63869eafb4ac13b55bc30c80e4e04e63cee2
parent6c1e654437b7d3fff8bb8315d61afa0e930d6776
setup: prepare setup_discovered_git_dir() for the root directory

Currently, the offset parameter (indicating what part of the cwd
parameter corresponds to the current directory after discovering the
.git/ directory) is set to 0 when we are running in the root directory.

However, in the next patches we will avoid changing the current working
directory while searching for the .git/ directory, meaning that the
offset corresponding to the root directory will have to be 1 to reflect
that this directory is characterized by the path "/" (and not "").

So let's make sure that setup_discovered_git_directory() only tries to
append the trailing slash to non-root directories.

Note: the setup_bare_git_directory() does not need a corresponding
change, as it does not want to return a prefix.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
setup.c