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

From: Torsten Bögershausen <[email-masked]>
Date: Wed, 09 Jul 2014 08:14:58 +0200

>> 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.
A "brute force" approach could be to simply run the config file(s) 
through sort and compare them:

sort <.git/modules/sub1/config >expect &&
sort <sub1/.git/config >actual &&
test_cmp expect actual &&
rm expect actual &&
cp git/modules/sub1/config sub1/.git/config

[end of scriptlet]
And here the "dumps" of the 2 config files:
.......
Branch remove_sub1 set up to track remote branch remove_sub1 from origin.
warning: unable to rmdir sub1: Directory not empty
Updating 68c8810..81b9f6a
Fast-forward
  .gitmodules | 4 ----
  1 file changed, 4 deletions(-)
  delete mode 100644 .gitmodules
---------------------
[core]
         repositoryformatversion = 0
         filemode = true
         bare = false
         logallrefupdates = true
         worktree = ../../../sub1
         ignorecase = true
         precomposeunicode = true
[remote "origin"]
         url = /Users/tb/projects/git/tb.140704_JensLehman/t/trash 
directory.t7613-merge-submodule/submodule_update_repo/.
         fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
         remote = origin
         merge = refs/heads/master
----------------
[core]
         repositoryformatversion = 0
         filemode = true
         bare = false
         logallrefupdates = true
         ignorecase = true
         precomposeunicode = true
         worktree = ../../../sub1
[remote "origin"]
         url = /Users/tb/projects/git/tb.140704_JensLehman/t/trash 
directory.t7613-merge-submodule/submodule_update_repo/.
         fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
         remote = origin
         merge = refs/heads/master
=====================
diff -r .git/modules/sub1/config sub1/.git/config
6d5
<       worktree = ../../../sub1
8a8
 >       worktree = ../../../sub1
not ok 7 - git merge: removed submodule leaves submodule containing a 
.git directory alone