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

Re: What does "modified" in git status mean?

From
Jeff King <peff@peff.net>
Date
Jan 24, 2012, 18:57 UTC
Message-ID
<20120124185716.GA5546@sigill.intra.peff.net>
In-Reply-To
<loom.20120122T174204-274@post.gmane.org>
On Sun, Jan 22, 2012 at 04:57:52PM +0000, Mikolas wrote:
Show 13 quoted lines
> So it looks something like this:
> $ git status
> # On branch master
> nothing to commit (working directory clean)
> 
> $ cd foo
> $ git status
> # On branch master
> # Changes not staged for commit:
> #   (use "git add <file>..." to update what will be committed)
> #   (use "git checkout -- <file>..." to discard changes in working directory)
> #
> #       modified:   ../foo/bar

Modified files appearing only in some calls to status is definitely odd, and may be a bug. How close is this to your actual invocation?

In particular, if "foo/bar" is modified, and you do "cd foo && git status", then the relative path shown by "git status" should be simply "bar", not "../foo/bar". If you did "cd other && git status", then I would expect it to say "../foo/bar".

So was the directory you entered the same as the one that contains the (supposedly) modified file, yielding the output above?

If that is the case, then I might suspect it has to do with path normalization and case sensitivity. It might be worth seeing if you can reproduce the problem with a more recent version of git. In particular, v1.7.8 and later shipped with my 2548183 (fix phantom untracked files when core.ignorecase is set, 2011-10-06), which fixes some weird bugs surrounding case-insensitive file lookup.

(Actually, even if that is not the case, it would be worth upgrading and seeing if the bug is reproducible).

> So my questions are 
> 1) Is there some way how to tell status to tell me *why* the files are marked 
> as modified?

Typically you would ask "diff" for more details. But since "diff" is not reporting anything, that isn't helpful (and is probably indicative of a bug).

> 2) Is it normal that git status behaves differently in different directories?
No.
-Peff
Previous: Phillip Susi
Message 4 of 4 in “What does "modified" in git status mean?”
  1. MikolasJan 22, 2012
  2. Seth RobertsonJan 22, 2012
  3. Phillip SusiJan 23, 2012
  4. Jeff KingJan 24, 2012

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.