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

Re: submodules' shortcomings, was Re: RFC: display dirty submodule working directory in git gui and gitk

From
Jens Lehmann <jens.lehmann@web.de>
Date
Jan 6, 2010, 21:19 UTC
Message-ID
<4B44FE58.3030209@web.de>
In-Reply-To
<7vbph7uhn9.fsf@alter.siamese.dyndns.org>
Am 06.01.2010 21:01, schrieb Junio C Hamano:
Show 51 quoted lines
> Jens Lehmann <Jens.Lehmann@web.de> writes:
> 
>> Am 06.01.2010 18:55, schrieb Junio C Hamano:
>>> I was envisioning that the "git status" in submodule will be run with its
>>> recent --porcelain option, and "git status" or "git commit" would read it
>>> to postprocess and incorporate into its own output.
>>
>> And i thought about printing just one line for each dirty submodule that
>> contains uncommitted and/or new files. I did not intend to list every
>> file, for the same reason a "git diff --submodule" only shows the first
>> line of the commit messages, not the actual differences of all changed
>> files in the submodule. I am not against being able to show all files
>> too, but i really would want to have an option to get a short output for
>> git gui and gitk.
> 
> I don't think what you are saying is inconsistent with "git status/commit
> that reads from 'git status --porcelain' it runs in a submodule directory,
> postprocesses it and incorporates it into its own output."  When the
> sub-status reports changes, your "postprocess" would condense it down to
> "this has a potential change that user could want to commit".  How the
> dirtiness is shown is entirely up to the caller that detected that change.
> 
> Let's explain it in another way.
> 
> The original "diff" for a submodule entry was implemented by preparing a
> 
> 	"Subproject commit %s\n"
> 
> line for the submodule commit recorded in the preimage and postimage, and
> compare these as if they are one-line files.  When the postimage was work
> tree, it looked at submodule's .git/HEAD to learn what to stuff in %s
> there.
> 
> But nobody forced you to limit the check only to .git/HEAD in the
> submodule.  To make the comparison richer, you could check if the
> submodule directory is dirty (and we have already discussed the potential
> definition of dirtiness earlier), and add "-dirty" in the string as well.
> With such a change, if you make some changes to a file in the work tree of
> the submodule after a clean "clone", "git diff" between the index and the
> work tree would report:
> 
> 	-Subproject commit 37bae10e38a66e4f1ddd5350daded00b21735126
> 	+Subproject commit 37bae10e38a66e4f1ddd5350daded00b21735126-dirty
> 
> The suggestion to read from "status --porcelain" that is run in the
> submodule directory was about how to implement the part that determines
> this "dirtiness" information, and not about how that dirtiness is
> expressed in the output.  The above is an illustration that even the
> traditional output format can be made aware of this submodule dirtiness
> check.  "diff --submodule" can express that dirtiness information in any
> way it wants.
I see, we seem to agree again :-)

While looking into "git status" in the last hours i became aware that there is some infrastructure for calling "git submodule summary" (when that is enabled via "git config status.submodulesummary"). I think this can be extended to transfer the dirty information from "git diff --submodule" (which can and should replace "git submodule summary" IMO) into "git status".

Will send a patch for discussion tomorrow, i have to get some sleep now.
Previous: Junio C HamanoNext: Jens Lehmann
Message 26 of 45 in “RFC: display dirty submodule working directory in git gui and gitk”
  1. Jens LehmannJan 2, 2010
  2. Johannes SchindelinJan 4, 2010
  3. Heiko VoigtJan 4, 2010
  4. submodules, was Re: RFC: display dirty submodule working directory in git gui and gitkJohannes Schindelin, Jan 4, 2010
  5. Avery PennarunJan 4, 2010
  6. Jens LehmannJan 4, 2010
  7. Jens LehmannJan 4, 2010
  8. submodules' shortcomings, was Re: RFC: display dirty submodule working directory in git gui and gitkJohannes Schindelin, Jan 4, 2010
  9. Shawn O. PearceJan 4, 2010
  10. Avery PennarunJan 4, 2010
  11. Avery PennarunJan 4, 2010
  12. Jens LehmannJan 5, 2010
  13. Junio C HamanoJan 5, 2010
  14. Johannes SchindelinJan 5, 2010
  15. Jens LehmannJan 5, 2010
  16. Junio C HamanoJan 5, 2010
  17. Jens LehmannJan 5, 2010
  18. Junio C HamanoJan 6, 2010
  19. Jens LehmannJan 6, 2010
  20. Junio C HamanoJan 6, 2010
  21. Nguyen Thai Ngoc DuyJan 6, 2010
  22. Junio C HamanoJan 6, 2010
  23. Nguyen Thai Ngoc DuyJan 6, 2010
  24. Jens LehmannJan 6, 2010
  25. Junio C HamanoJan 6, 2010
  26. Jens LehmannJan 6, 2010
  27. Jens LehmannJan 6, 2010
  28. Johannes SchindelinJan 5, 2010
  29. Johannes SchindelinJan 5, 2010
  30. Jens LehmannJan 5, 2010
  31. Heiko VoigtJan 5, 2010
  32. Johan HerlandJan 5, 2010
  33. Johannes SchindelinJan 5, 2010
  34. Nanako ShiraishiJan 5, 2010
  35. Johannes SchindelinJan 5, 2010
  36. Nanako ShiraishiJan 7, 2010
  37. Pau Garcia i QuilesJan 5, 2010
  38. cmake, was Re: submodules' shortcomingsJohannes Schindelin, Jan 5, 2010
  39. Pau Garcia i QuilesJan 6, 2010
  40. Miles BaderJan 6, 2010
  41. Johannes SchindelinJan 6, 2010
  42. Nguyen Thai Ngoc DuyJan 4, 2010
  43. Jens LehmannJan 4, 2010
  44. Junio C HamanoJan 4, 2010
  45. Jens LehmannJan 4, 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.