Re: git diff in subdirectories
Junio C Hamano <junkio@cox.net> wrote:
Show 7 quoted lines
> I noticed that "git diff" from subdirectories does not seem to
> pick up the configuration from $GIT_DIR/config properly. I
> suspect that fixing this breakage properly would help us later,
> as more and more commands learn to use the configuration
> mechanism to store user preferences, and the same fix would be
> applicable to them. If somebody can fix this while we are away
> this week, that would be wonderful ;-).
I can think of these ways to fix this:
- Allow git_config() to work in subdirectories.
- It can either change the working directory using
setup_git_directory_gently() and go back to the subdirectory
later.
- Or we add a function to get the full path to the repository. This
could perhaps also be used in setup_git_env() to initialize
git_dir? Otherwise I would just add another function similar to
git_path pointing to the full path instead of .git/. (This is the
way I'd prefer.)
- Fix the it in builtin-diff: change the directory before calling
git_config(). Then we would either need to change the directory
back or add a parameter to init_revisions to get the prefix without
calling setup_git_directory itself. (I think this will change the
least code but wont help other commands.)Any comments?