@@ -93,7 +93,8 @@ then
93 else toString gitDir + "/config";
93 else toString gitDir + "/config";
95 # We need the .gitmodules file for submoules to work.
95 # We need the .gitmodules file for submoules to work.
96+ gitModulesStr = toString src + "/.gitmodules";
96− gitModules = builtins.path { name = "gitmodules"; path = toString src + "/.gitmodules"; };
97+ gitModules = builtins.path { name = "gitmodules"; path = gitModulesStr; };
98 # Make a temporary dir that looks enough like the real thing for
99 # Make a temporary dir that looks enough like the real thing for
99 # `git ls-files --recurse-submodules` to give us an accurate list
100 # `git ls-files --recurse-submodules` to give us an accurate list
@@ -108,7 +109,9 @@ then
108 mkdir -p .git-common/objects .git-common/refs
109 mkdir -p .git-common/objects .git-common/refs
109 cp ${commonConfig} .git-common/config
110 cp ${commonConfig} .git-common/config
110 echo ../.git-common > .git/commondir
111 echo ../.git-common > .git/commondir
112+ ${ lib.optionalString (builtins.pathExists gitModulesStr) ''
111− cp ${gitModules} ./.gitmodules
113+ cp ${gitModules} ./.gitmodules
112 ${git}/bin/git ls-files --recurse-submodules > $out
115 ${git}/bin/git ls-files --recurse-submodules > $out