Fix setup_git_directory_gently() with relative GIT_DIR & GIT_WORK_TREE
commitdd5c8af176bb935a0b01a7dc2d5e022565c3aac3
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Tue, 16 Oct 2007 23:37:36 +0000 (17 00:37 +0100)
committerShawn O. Pearce <spearce@spearce.org>
Wed, 17 Oct 2007 00:18:04 +0000 (16 20:18 -0400)
tree7bcd6b5db31c7b9317240b2f904d92df8437bbc1
parent33c8d38c7879ee9af0365481eecb4b3906da111a
Fix setup_git_directory_gently() with relative GIT_DIR & GIT_WORK_TREE

There are a few programs, such as config and diff, which allow running
without a git repository.  Therefore, they have to call
setup_git_directory_gently().

However, when GIT_DIR and GIT_WORK_TREE were set, and the current
directory was a subdirectory of the work tree,
setup_git_directory_gently() would return a bogus NULL prefix.

This patch fixes that.

Noticed by REPLeffect on IRC.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
setup.c
t/t1501-worktree.sh