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

Re: [regression?] "git status -a" reports modified for empty submodule directory

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 30, 2008, 07:29 UTC
Message-ID
<7vej8n3imp.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<4818143C.6050206@viscovery.net>
Johannes Sixt <j.sixt@viscovery.net> writes:
Show 17 quoted lines
> Junio C Hamano schrieb:
>> "Ping Yin" <pkufranky@gmail.com> writes:
>> 
>>> In the super project super with empty submodule directory sub
>>> $ git diff
>>> diff --git a/sub b/sub
>>> deleted file mode 160000
>>> index f2c0d45..0000000
>>> --- a/sub
>>> +++ /dev/null
>>> @@ -1 +0,0 @@
>>> -Subproject commit f2c0d4509a3178c...
>> 
>> The repository used to have a subproject and now it doesn't.  Why
>> shouldn't it report the removal?
>
> Because you are not required to have a subproject checked out?
Yes, but.
This is a policy issue, which is not very well enforced currently.

I have been scratching my head to figure out where the right balance we should strike at for the past week and a half.

For example, it has long been known ever since submodules were introduced that if you work inside a sparsely checked out supermodule you have to use "commit -a" with care, because the command notices missing submodule, and there is no way for it to differenciate between the case you _want to_ remove it and the case you did not care about it, so you will end up removing unchecked out submodules.

That quirk was something people could live with while submodule support was merely a newly invented curiosity. But I do not think a command at high level (iow Porcelain) such as commit and status should be left unaware of the Policy that equate missing submodule and unmodified one forever. We should actively enforce the policy, so that unless you explicitly ask nicely, the command should consider a missing submodule just as unmodified, e.g. "commit -a" should not remove unchecked out submodules.

But then you would need a way to ask nicely. How? Perhaps using "git rm", and low level "update-index --remove". Do we even need "commit -A"? I doubt it --- you do not remove submodules every day.

We'd like to keep the lowest-level unaware of the Policy, which means that "diff-files" and "diff-index" should report unchecked out submodules. Otherwise script writers will be left with no way to differenciate missing and removed submodules.

Once we start doing this, I think "git diff" Porcelain should fall into Policy-aware category.

Previous: Johannes SixtNext: Ping Yin
Message 13 of 28 in “[regression?] "git status -a" reports modified for empty submodule directory”
  1. Ping YinApr 22, 2008
  2. Ping YinApr 22, 2008
  3. Johannes SixtApr 22, 2008
  4. Ping YinApr 22, 2008
  5. Johannes SixtApr 22, 2008
  6. Roman ShaposhnikApr 22, 2008
  7. Ping YinApr 29, 2008
  8. 0/2 Add tests for submodule with empty directoryPing Yin, Apr 29, 2008
  9. 1/2 t4027: test diff for submodule with empty directoryPing Yin, Apr 29, 2008
  10. 2/2 Add t7506 to test submodule related functions for git-statusPing Yin, Apr 29, 2008
  11. Junio C HamanoApr 29, 2008
  12. Johannes SixtApr 30, 2008
  13. Junio C HamanoApr 30, 2008
  14. Ping YinApr 30, 2008
  15. 0/4 Fix regression for unchecked out submodulesPing Yin, May 2, 2008
  16. 1/4 t4027: test diff for submodule with empty directoryPing Yin, May 2, 2008
  17. 2/4 Add t7506 to test submodule related functions for git-statusPing Yin, May 2, 2008
  18. 3/4 Fix diff regression for submodules not checked outPing Yin, May 2, 2008
  19. 4/4 Fix ie_match_stat for non-checked-out submodulePing Yin, May 2, 2008
  20. Junio C HamanoMay 2, 2008
  21. Ping YinMay 2, 2008
  22. Junio C HamanoMay 2, 2008
  23. Ping YinMay 2, 2008
  24. Ping YinMay 3, 2008
  25. Johannes SchindelinMay 3, 2008
  26. Junio C HamanoMay 3, 2008
  27. Junio C HamanoMay 4, 2008
  28. Ping YinMay 4, 2008

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.