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

Re: Possible bug with git status in 1.7.0

From
Sergio Callegari <sergio.callegari@gmail.com>
Date
Feb 17, 2010, 19:52 UTC
Message-ID
<4B7C490B.8030902@gmail.com>
In-Reply-To
<7vvddvoegv.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 18 quoted lines
> Sergio <sergio.callegari@gmail.com> writes:
>
>   
>> if you have a submodule and the submodule contains
>> untracked files, "git status" in 1.7.0 keeps showing
>> the module as modified.
>>
>> But of of course it is useless to "git add" the module
>> or to try to "git  commit -a", since the index entry is ok
>>     
>
> Of course it is useless to "git add" in the superproject, and this is
> an intended bugfix.
>
> You are getting reminded that you either forgot to "git add" that file in
> the submodule, or you forgot to add that file to .gitignore in the
> submodule.
>   
Thanks for the explanation!

The wording of the reminder is a bit unclear, though. Suppose that the problem is with submodule "mod".

What you get from git status is a notice that something is modified but not updated, with the following suggestion

# Changed but not updated:

#   (use "git add <file>..." to update what will be committed)
and then the notice about what is in fact modified
#       modified:   mod

So the first problem is that now git status provides a hint that may be confusing. One gets the idea that he needs to add mod (to store a new commit id in the index) and not to add a file in mod.

As a second issue, note that mod is in fact not really modified being that
1) no tracked file in it has been modified.
2) no new commit has been made

and the fact is that from git status I cannot recognize anymore if the module is really changed (the module commit id has changed) or has uncommited changes (some tracked file is changed) or is merely polluted by untracked files, so now I always need to explore the submodule.

It is true that this can be solved putting more stuff in .gitignore. However, it might be a matter of taste, but I do not like putting all byproducts in .gitignore because not doing so allows me to differentiate between

- files that are just garbage
- files that are not tracked but may be still precious

and selectively clean either category using the -x or -X options of git clean.

So, it would be nice to improve the feedback of git status for this particular case and possibly have an option to avoid status being so wordy about untracked files.

Sergio
Previous: Junio C HamanoNext: Jens Lehmann
Message 3 of 7 in “Possible bug with git status in 1.7.0”
  1. SergioFeb 17, 2010
  2. Junio C HamanoFeb 17, 2010
  3. Sergio CallegariFeb 17, 2010
  4. Jens LehmannFeb 17, 2010
  5. Sergio CallegariFeb 19, 2010
  6. Jens LehmannFeb 19, 2010
  7. Sergio CallegariFeb 20, 2010

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.