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

Re: Feature request: Limit git-status reports to a directory

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Oct 25, 2007, 09:55 UTC
Message-ID
<Pine.LNX.4.64.0710251050390.25221@racer.site>
In-Reply-To
<46dff0320710241914t7d93aae1t991fbcaacde77046@mail.gmail.com>
Hi,
On Thu, 25 Oct 2007, Yin Ping wrote:
Show 9 quoted lines
> On 10/25/07, Michel Marti <mma@objectxp.com> wrote:
> > I am sometimes interested in only seeing the status for a specific 
> > directory (and its sub-directories), but git-status is no help in this 
> > case - passing a directory does some sort of "git-commit --dry-run". I 
> > first thought that this is a bug until I saw in the man-page that this 
> > is actually a feature...
>
> It's also painful for me. IMHO, the behaviour of "git-status" should 
> keep consistent with "git-diff" and "git-log" which allow for the path.

I am not so sure. In other SCMs, "git status" may be a way to do "git diff --name-only" or "git ls-files", but not in git. Here, it strictly means "what would be happening if I were to commit _right_ _now_?".

Show 5 quoted lines
> Another point, It will be helpful to add a config item to change the 
> default behaviour for 'git-diff" and "git-log". For example, 
> 'diff.defaultcurrentpath=true' to let git only show difference in 
> current directory instead of difference in top directory when typing 
> 'git-diff'

IMHO it is not asking users too much when you say "git diff ." is for the current directory, and "git diff" is for the whole working tree.

Besides, we cannot really change the default behaviour, since some porcelains use "git log" (and certainly there are some which use "git diff", too). They would suffer from this unexpected -- and indeed inconsistent, since the setting can differ between repositories -- output.

Hth, Dscho

Previous: Yin PingNext: Wincent Colaiuta
Message 3 of 5 in “Feature request: Limit git-status reports to a directory”
  1. Michel MartiOct 24, 2007
  2. Yin PingOct 25, 2007
  3. Johannes SchindelinOct 25, 2007
  4. Wincent ColaiutaOct 25, 2007
  5. Michel MartiOct 25, 2007

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.