git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git diff in subdirectories

From
MLMatthias Lederhofer <matled@gmx.net>
Date
Jul 17, 2006, 14:44 UTC
Message-ID
<E1G2UKT-0004ks-RW@moooo.ath.cx>
In-Reply-To
<7vhd1ghbwo.fsf@assigned-by-dhcp.cox.net>
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?
Previous: Junio C Hamano
Message 2 of 2 in “What's in git.git”
  1. Junio C HamanoJul 17, 2006
  2. Matthias LederhoferJul 17, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.