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

Re: [PATCH 0/2] Tests for some submodule corner cases.

From
Marc Branchaud <marcnarc@xiplink.com>
Date
Jun 1, 2011, 16:11 UTC
Message-ID
<4DE664A1.5060206@xiplink.com>
In-Reply-To
<4DE55D0F.1020905@web.de>
On 11-05-31 05:26 PM, Jens Lehmann wrote:
Show 21 quoted lines
> Am 31.05.2011 23:06, schrieb Marc Branchaud:
>> On 11-05-31 03:30 PM, Jens Lehmann wrote:
>>> Am 30.05.2011 23:51, schrieb Marc Branchaud:
>>>> Patch 2 exposes an anomaly in "submodule status", which reports that a
>>>> submodule is OK even though it has deleted files.  "git status" inside
>>>> the submodule (and in the super-repo) both identify any deleted files, but
>>>> "submodule status" doesn't prefix the submodule's HEAD SHA-ID with a "+".
>>>
>>> That is documented behavior. "git submodule status" only cares about the
>>> commit recorded in the superproject vs the HEAD in the submodule, work
>>> tree modifications are never shown by it.
>>>
>>> But try a "git status" in the superproject, that will give you the following
>>> output:
>>> #	modified:   init (modified content)
>>
>> I understand.  My apologies for not reading the man page closely enough.
> 
> No problem, maybe that's just an indication that a reference to "git status"
> being more capable of telling what is going on inside a submodule is missing
> to the man page for "git submodule status".
Yes, that'd possibly help.
Show 10 quoted lines
>> I know there's been a lot of recent work on making "git status"
>> submodule-friendly, but would there be any interest in having another prefix
>> for submodule status to cover this case?  Maybe ! could indicate that the
>> submodule's HEAD is correct, but the working directory doesn't match it exactly.
> 
> I'd rather leave "git submodule status" as it is and incorporate this kind
> of functionality into core git (for "submodule status" it already arrived there
> in 1.7.0/1.7.1, so that part is finished ;-). I hope making the "git submodule"
> script mostly obsolete in the long run and would want to avoid teaching it new
> stuff already covered by core git.
A noble goal, certainly.

So here's my basic question: How can my build system be sure that a submodule contains the correct working directory? Do I need to do both "git submodule status" to check the submodule's HEAD, then also use "git status" to see if that HEAD is correctly checked out?

Note that my automated builds don't really care about possibly-modified files or anything like that. They just want the exact tree that corresponds to the commit ID recorded in the superproject. (Previous builds might've left some cruft lying around, and the automated build wants to be sure that's eliminated.)

Maybe I should just forego the status-checking altogether, and do "git submodule update path/to/sub && (cd path/to/sub; git reset --hard HEAD; git clean -dx)".

		M.
Previous: Jens LehmannNext: Junio C Hamano
Message 38 of 40 in “Tests for some submodule corner cases.”
  1. 0/2 Tests for some submodule corner cases.Marc Branchaud, May 30, 2011
  2. 1/2 Added a test for "submodule add" using a ../relative/path/to/the/submodule/repoMarc Branchaud, May 30, 2011
  3. 2/2 Added a test for "submodule status" when the submodule's working directory has deleted files.Marc Branchaud, May 30, 2011
  4. Jens LehmannMay 31, 2011
  5. submodule add: improve message when resolving a relative url failsJens Lehmann, May 31, 2011
  6. Marc BranchaudMay 31, 2011
  7. submodule add: improve message when resolving a relative url failsJens Lehmann, May 31, 2011
  8. Phil HordMay 31, 2011
  9. Marc BranchaudJun 1, 2011
  10. Phil HordJul 27, 2011
  11. Marc BranchaudJul 29, 2011
  12. Junio C HamanoMay 31, 2011
  13. Clarified how "git submodule add" handles relative paths.Marc Branchaud, Jun 1, 2011
  14. Junio C HamanoJun 1, 2011
  15. Jens LehmannJun 1, 2011
  16. Junio C HamanoJun 2, 2011
  17. Jens LehmannJun 3, 2011
  18. Junio C HamanoJun 3, 2011
  19. Mark LevedahlJun 4, 2011
  20. Jens LehmannJun 4, 2011
  21. Jens LehmannJun 4, 2011
  22. Junio C HamanoJun 5, 2011
  23. 0/3 submodule add: allow relative repository path even when no url is setJens Lehmann, Jun 6, 2011
  24. 1/3 submodule add: test failure when url is not configured in superprojectJens Lehmann, Jun 6, 2011
  25. 2/3 submodule add: allow relative repository path even when no url is setJens Lehmann, Jun 6, 2011
  26. 0/2 Improve "git submodule add" documentation.Marc Branchaud, Jun 6, 2011
  27. 1/2 More precisely described how "git submodule add" handles relative submodule URLs.Marc Branchaud, Jun 6, 2011
  28. 2/2 Moved paragraph describing the utility of relative submodule URLs.Marc Branchaud, Jun 6, 2011
  29. 3/3 submodule add: clean up duplicated codeJens Lehmann, Jun 6, 2011
  30. Junio C HamanoJun 6, 2011
  31. Marc BranchaudJun 6, 2011
  32. Jens LehmannJun 6, 2011
  33. Jens LehmannJun 7, 2011
  34. Phil HordJun 8, 2011
  35. [PATCHv2] Clarified how "git submodule add" handles relative paths.Marc Branchaud, Jun 2, 2011
  36. Marc BranchaudMay 31, 2011
  37. Jens LehmannMay 31, 2011
  38. Marc BranchaudJun 1, 2011
  39. Junio C HamanoJun 1, 2011
  40. Jens LehmannJun 1, 2011

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.