Description of problem: Adding a git submodule that contains a submodule fails upon git push Version-Release number of selected component (if applicable): How reproducible: multiple users have reported the same results for multiple repositories Steps to Reproduce: 1. Create a new (PHP5.3, default, small, no scaling) application and clone it locally. 2. Add a submodule to it that contains submodules (in this case it is a particular branch): --2.1 git submodule add https://github.com/habari/system.git php/system --2.2 cd php/system --2.3 git checkout 0.9.1 --2.4 cd ../.. --2.5 git commit -am "Updated submodule to branch with submodules" 3. git push Actual results: Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 505 bytes, done. Total 4 (delta 1), reused 0 (delta 0) remote: CLIENT_MESSAGE: Stopping Apache+mod_php HTTPD server remote: Waiting for stop to finish remote: An error occurred executing 'gear postreceive' remote: stdout: Initialized empty Git repository in /tmp/git_cache/.git/ remote: Submodule 'php/system' (https://github.com/habari/system/) registered for path 'php/system' remote: Initialized empty Git repository in /tmp/git_cache/php/system/.git/ remote: Submodule path 'php/system': checked out '0f2f5621d5f1317c08fd8ab622704a60c583ac97' remote: Submodule 'locale/da' (https://github.com/habari-locales/da) registered for path 'locale/da' remote: Submodule 'locale/de' (https://github.com/habari-locales/de) registered for path 'locale/de' remote: Submodule 'locale/es' (https://github.com/habari-locales/es) registered for path 'locale/es' remote: Submodule 'locale/fr' (https://github.com/habari-locales/fr) registered for path 'locale/fr' remote: Submodule 'locale/it' (https://github.com/habari-locales/it) registered for path 'locale/it' remote: Submodule 'locale/ja' (https://github.com/habari-locales/ja) registered for path 'locale/ja' remote: Submodule 'locale/ru' (https://github.com/habari-locales/ru) registered for path 'locale/ru' remote: Submodule 'locale/zh_TW' (https://github.com/habari-locales/zh_TW) registered for path 'locale/zh_TW' remote: Initialized empty Git repository in /tmp/git_cache/php/system/locale/da/.git/ remote: Submodule path 'locale/da': checked out '2f7a8e91be75a45222d63fe531fe90cf983a0fbb' remote: Initialized empty Git repository in /tmp/git_cache/php/system/locale/de/.git/ remote: Submodule path 'locale/de': checked out '872e9cd4989bd5419d617cf8841cc2a194b5029f' remote: Initialized empty Git repository in /tmp/git_cache/php/system/locale/es/.git/ remote: Submodule path 'locale/es': checked out '47d8176472276389915e962d7d3c2fb614432951' remote: Initialized empty Git repository in /tmp/git_cache/php/system/locale/fr/.git/ remote: Submodule path 'locale/fr': checked out 'c1343cae78f1afcd834108417f3f3a925f47925c' remote: Initialized empty Git repository in /tmp/git_cache/php/system/locale/it/.git/ remote: Submodule path 'locale/it': checked out '2de883fc3a7a418e86c96dcccf5a628699d7e439' remote: Initialized empty Git repository in /tmp/git_cache/php/system/locale/ja/.git/ remote: Submodule path 'locale/ja': checked out 'b0936b4fe717ee1c548c07cd0b705d91b311f510' remote: Initialized empty Git repository in /tmp/git_cache/php/system/locale/ru/.git/ remote: Submodule path 'locale/ru': checked out '7718c03d863688ac193945bc2f8b3d6398c18d3d' remote: Initialized empty Git repository in /tmp/git_cache/php/system/locale/zh_TW/.git/ remote: Submodule path 'locale/zh_TW': checked out 'ee6d8a9f9cc8bc53ff3cf363227b09355ec8cd9d' remote: Entering 'php/system' remote: Entering 'php/system/locale/da' remote: stderr: + pushd /tmp/ remote: + git clone /var/lib/openshift/51bf558b5973ca528f000021/git/bug.git git_cache remote: + pushd git_cache remote: + git submodule update --init --recursive remote: + git submodule foreach --recursive 'git archive --format=tar HEAD | (cd /var/lib/openshift/51bf558b5973ca528f000021/app-root/runtime/repo/$name && tar --warning=no-timestamp -xf -)' remote: /usr/libexec/git-core/git-submodule: line 283: cd: /var/lib/openshift/51bf558b5973ca528f000021/app-root/runtime/repo/locale/da: No such file or directory remote: Stopping at 'locale/da'; script returned non-zero status. remote: Stopping at 'php/system'; script returned non-zero status. remote: remote: For more details about the problem, try running the command again with the '--trace' option. To ssh://51bf558b5973ca528f000021.com/~/git/bug.git/ 30e125b..e5106a3 master -> master Expected results: Without the nested submodules the push succeeds. Additional info: From the looks of it, the recursive git archive isn't looking in the right directory. If it's a submodule of a submodule, the path would need to be app-root/runtime/repo/$outer-repo-name/$inner-repo-name, I think. /var/lib/openshift/.../app-root/runtime/repo/* was not accessible to me as a regular user.
I can confirm that. Beside the PHP cartridge, I also observed the same behavior on a DIY cartridge. Log: http://pastebin.com/rM0pR641 BTW: 'Datei oder Verzeichnis nicht gefunden' means 'File or Directory not found' ;)
While it's not explicitly mentioned as an available variable in the git-submodule manpage, the variable used in the "Entering <dirname>" message during recursive commands is $prefix, so replacing \$name with \$prefix looks as though it would fix this. ]\> git submodule foreach --recursive 'echo $name' Entering 'php/system' php/system Entering 'php/system/locale/da' locale/da Entering 'php/system/locale/de' locale/de ... versus: ]\> git submodule foreach --recursive 'echo $prefix' Entering 'php/system' php/system/ Entering 'php/system/locale/da' php/system/locale/da/ Entering 'php/system/locale/de' php/system/locale/de/ ...
Fixed in https://github.com/openshift/origin-server/pull/2894
Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/1586aeb6db061e39d4d3835e6bc1834963805c69 Bug 975183 - nested submodule repository cannot be found * lib/module001/module002 was not supported * test added
It's fixed, verified on devenv_3384, please refer to the following results: 1. Create a new (PHP5.3, default, small, no scaling) application and clone it locally. 2. Add a submodule to it that contains submodules (in this case it is a particular branch): --2.1 git submodule add https://github.com/habari/system.git php/system --2.2 cd php/system --2.3 git checkout 0.9.1 --2.4 cd ../.. --2.5 git commit -am "Updated submodule to branch with submodules" 3. git push \> git push Counting objects: 6, done. Delta compression using up to 4 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (4/4), 505 bytes, done. Total 4 (delta 1), reused 0 (delta 0) remote: CLIENT_MESSAGE: Stopping Apache+mod_php HTTPD server remote: Waiting for stop to finish remote: CLIENT_MESSAGE: Starting Apache+mod_php HTTPD server To ssh://51c1733f61aa6a09ed000004.rhcloud.com/~/git/cphp00.git/ 32dad38..59bbf57 master -> master