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

Re: [PATCH 00/14] Add submodule test harness

From
Jens Lehmann <jens.lehmann@web.de>
Date
Jul 9, 2014, 18:19 UTC
Message-ID
<53BD87B3.8050901@web.de>
In-Reply-To
<53BCDDE2.1080301@web.de>
Am 09.07.2014 08:14, schrieb Torsten Bögershausen:
Show 19 quoted lines
> 
>>> There seems to be some other trouble under Mac OS, not yet fully tracked down,
>>> (may be related to the "diff -r")
>> Torsten sees failures of this kind under Mac OS:
>>
>> diff -r .git/modules/sub1/config sub1/.git/config
>> 6d5
>> <     worktree = ../../../sub1
>> 8a8
>>>      worktree = ../../../sub1
>> So the config contains the same content, but the worktree setting moved
>> to a different line. This seems to be the result of setting core.worktree
>> in the test_git_directory_is_unchanged function just before the "diff -r",
>> but only under Mac OS.
>>
> So I was suspecting diff -r beinng non-portable, but that doesn't seem to be the problem here.
> (But I wouldn't be surprised if there where problems with diff -r on some Unix systems)
> Anyway, checking all the files in the working tree seems to be a good thing to do,
> but that does not necessarily work for .git/config.

I agree, but this case is special. The test asserts that nobody added, modified or removed *anything* inside the .git directory. The reason for problem we are seeing here is that I have to remove the core.worktree setting when moving the git directory from .git/modules into the submodule work tree. So the test adds it again to be able to diff it, and this happens in a different line only on Mac OS as comparing the two core sections shows:

Show 10 quoted lines
> ---------------------
> [core]
>         repositoryformatversion = 0
>         filemode = true
>         bare = false
>         logallrefupdates = true
>         worktree = ../../../sub1
>         ignorecase = true
>         precomposeunicode = true
> [remote "origin"]
vs.
Show 10 quoted lines
> ----------------
> [core]
>         repositoryformatversion = 0
>         filemode = true
>         bare = false
>         logallrefupdates = true
>         ignorecase = true
>         precomposeunicode = true
>         worktree = ../../../sub1
> [remote "origin"]

And now it's clear what happens here: On Mac OS the ignorecase and precomposeunicode settings are added behind the worktree line, then re-adding worktree later for the comparison adds it after these two.

Could you please test the following? It should avoid this kind of problem by removing the core.worktree setting temporarily from the original config in .git/modules instead of adding it temporarily to .git/config: -----------------------8<-----------------------

diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh
index 3584755..98c86e3 100755
--- a/t/lib-submodule-update.sh
+++ b/t/lib-submodule-update.sh
@@ -143,18 +143,18 @@ replace_gitfile_with_git_dir () {
 }

 # Test that the .git directory in the submodule is unchanged (except for the
-# core.worktree setting, which we temporarily restore). Call this function
+# core.worktree setting, which we temporarily remove). Call this function
 # before test_submodule_content as the latter might write the index file
 # leading to false positive index differences.
 test_git_directory_is_unchanged () {
 	(
-		cd "$1" &&
-		git config core.worktree "../../../$1"
+		cd ".git/modules/$1" &&
+		git config --unset core.worktree
 	) &&
 	diff -r ".git/modules/$1" "$1/.git" &&
 	(
-		cd "$1" &&
-		GIT_WORK_TREE=. git config --unset core.worktree
+		cd ".git/modules/$1" &&
+		git config core.worktree "../../../$1"
 	)
 }
Previous: Junio C HamanoNext: Junio C Hamano
Message 51 of 65 in “Add submodule test harness”
  1. 00/14 Add submodule test harnessJens Lehmann, Jun 15, 2014
  2. 01/14 test-lib: add test_dir_is_empty()Jens Lehmann, Jun 15, 2014
  3. Junio C HamanoJun 16, 2014
  4. Jens LehmannJun 17, 2014
  5. 01/14 test-lib: add test_dir_is_empty()Jens Lehmann, Jun 19, 2014
  6. 02/14 submodules: Add the lib-submodule-update.sh test libraryJens Lehmann, Jun 15, 2014
  7. Junio C HamanoJun 16, 2014
  8. Jens LehmannJun 17, 2014
  9. Junio C HamanoJun 17, 2014
  10. Jens LehmannJun 17, 2014
  11. Junio C HamanoJun 17, 2014
  12. 02/14 submodules: Add the lib-submodule-update.sh test libraryJens Lehmann, Jun 19, 2014
  13. Junio C HamanoJun 20, 2014
  14. 02/14 submodules: Add the lib-submodule-update.sh test libraryJens Lehmann, Jul 1, 2014
  15. 03/14 checkout: call the new submodule update test frameworkJens Lehmann, Jun 15, 2014
  16. 04/14 apply: add t4137 for submodule updatesJens Lehmann, Jun 15, 2014
  17. 05/14 read-tree: add t1013 for submodule updatesJens Lehmann, Jun 15, 2014
  18. 06/14 reset: add t7112 for submodule updatesJens Lehmann, Jun 15, 2014
  19. 07/14 bisect: add t6041 for submodule updatesJens Lehmann, Jun 15, 2014
  20. 07/14 bisect: add t6041 for submodule updatesJens Lehmann, Jun 19, 2014
  21. 08/14 merge: add t7613 for submodule updatesJens Lehmann, Jun 15, 2014
  22. 09/14 rebase: add t3426 for submodule updatesJens Lehmann, Jun 15, 2014
  23. Eric SunshineJun 16, 2014
  24. Jens LehmannJun 17, 2014
  25. 09/14 rebase: add t3426 for submodule updatesJens Lehmann, Jun 19, 2014
  26. 10/14 pull: add t5572 for submodule updatesJens Lehmann, Jun 15, 2014
  27. 11/14 cherry-pick: add t3512 for submodule updatesJens Lehmann, Jun 15, 2014
  28. 12/14 am: add t4255 for submodule updatesJens Lehmann, Jun 15, 2014
  29. 13/14 stash: add t3906 for submodule updatesJens Lehmann, Jun 15, 2014
  30. 13/14 stash: add t3906 for submodule updatesJens Lehmann, Jun 19, 2014
  31. 14/14 revert: add t3513 for submodule updatesJens Lehmann, Jun 15, 2014
  32. 14/14 revert: add t3513 for submodule updatesJens Lehmann, Jun 19, 2014
  33. Torsten BögershausenJul 2, 2014
  34. Jens LehmannJul 2, 2014
  35. Torsten BögershausenJul 3, 2014
  36. Jens LehmannJul 3, 2014
  37. Junio C HamanoJul 7, 2014
  38. Torsten BögershausenJul 7, 2014
  39. Jens LehmannJul 8, 2014
  40. Ramsay JonesJul 8, 2014
  41. Ramsay JonesJul 8, 2014
  42. No fchmod() under msygit - Was: Re: [PATCH 00/14] Add submodule test harnessTorsten Bögershausen, Jul 9, 2014
  43. Eric WongJul 9, 2014
  44. Erik Faye-LundJul 14, 2014
  45. Nico WilliamsJul 14, 2014
  46. Nico WilliamsJul 14, 2014
  47. Karsten BleesJul 14, 2014
  48. Junio C HamanoJul 14, 2014
  49. Torsten BögershausenJul 9, 2014
  50. Junio C HamanoJul 9, 2014
  51. Jens LehmannJul 9, 2014
  52. Junio C HamanoJul 9, 2014
  53. Junio C HamanoJul 10, 2014
  54. Jens LehmannJul 12, 2014
  55. Junio C HamanoJul 14, 2014
  56. Jens LehmannJul 14, 2014
  57. Junio C HamanoJul 14, 2014
  58. Johannes SixtJul 9, 2014
  59. Junio C HamanoJul 9, 2014
  60. Eric WongJul 9, 2014
  61. Junio C HamanoJul 9, 2014
  62. No fchmd. was: Re: [PATCH 00/14] Add submodule test harnessTorsten Bögershausen, Jul 10, 2014
  63. Junio C HamanoJul 10, 2014
  64. Torsten BögershausenJul 10, 2014
  65. Junio C HamanoJul 10, 2014

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.