{"thread":{"id":"28047","subject":"[PATCH v2 0/2] submodule: move gitdir into superproject","startedAt":"2011-08-08T19:17:00Z","lastAt":"2011-08-11T23:34:53Z","messageCount":8,"participants":["Fredrik Gustafsson","Heiko Voigt","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"173146","messageId":"1312831022-12868-1-git-send-email-iveqy@iveqy.com","threadId":"28047","inReplyTo":null,"subject":"[PATCH v2 0/2] submodule: move gitdir into superproject","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2011-08-08T19:17:00Z","receivedAt":"2011-08-08T19:17:00Z","isPatch":true,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"Move git-dir for submodules into $GIT_DIR/modules/[name_of_submodule] of\nthe superproject. This is a step towards being able to delete submodule\ndirectories without loosing the information from their .git directory\nas that is now stored outside the submodules work tree.\n\nThis is done relying on the already existent .git-file functionality.\nTests that rely on .git being a directory have been fixed.\n\nThis is the second iteration of this patchseries. The first can be found here:\nhttp://thread.gmane.org/gmane.comp.version-control.git/177582\n\n\nFredrik Gustafsson (2):\n  rev-parse: add option --is-well-formed-git-dir [path]\n  Move git-dir for submodules\n\n Documentation/git-rev-parse.txt |    4 ++\n builtin/rev-parse.c             |    8 +++\n cache.h                         |    1 +\n git-submodule.sh                |   49 ++++++++++++++++--\n setup.c                         |    7 +++\n t/t7400-submodule-basic.sh      |    4 +-\n t/t7403-submodule-sync.sh       |    5 +-\n t/t7406-submodule-update.sh     |  107 +++++++++++++++++++++++++++++++++++++++\n t/t7407-submodule-foreach.sh    |  103 +++++++++++++++++++------------------\n t/t7408-submodule-reference.sh  |    4 +-\n 10 files changed, 231 insertions(+), 61 deletions(-)\n\n-- \n1.7.6.398.g47bcd.dirty\n"},{"id":"173148","messageId":"1312831022-12868-2-git-send-email-iveqy@iveqy.com","threadId":"28047","inReplyTo":"1312831022-12868-1-git-send-email-iveqy@iveqy.com","subject":"[PATCH v2 1/2] rev-parse: add option --is-well-formed-git-dir [path]","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2011-08-08T19:17:01Z","receivedAt":"2011-08-08T19:17:01Z","isPatch":true,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"Check if [path] is a valid git-dir or a valid git-file that points\nto a valid git-dir.\n\nWe want tests to be independent from the fact that a git-dir may\nbe a git-file. Thus we changed tests to use this feature.\n\nSigned-off-by: Fredrik Gustafsson <iveqy@iveqy.com>\nMentored-by: Jens Lehmann <Jens.Lehmann@web.de>\nMentored-by: Heiko Voigt <hvoigt@hvoigt.net>\n---\n Documentation/git-rev-parse.txt |    4 ++\n builtin/rev-parse.c             |    8 +++\n cache.h                         |    1 +\n setup.c                         |    7 +++\n t/t7400-submodule-basic.sh      |    4 +-\n t/t7403-submodule-sync.sh       |    5 +-\n t/t7407-submodule-foreach.sh    |   97 ++++++++++++++++++++-------------------\n 7 files changed, 75 insertions(+), 51 deletions(-)\n\ndiff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt\nindex 42c9676..3ce81c0 100644\n--- a/Documentation/git-rev-parse.txt\n+++ b/Documentation/git-rev-parse.txt\n@@ -180,6 +180,10 @@ print a message to stderr and exit with nonzero status.\n <args>...::\n \tFlags and parameters to be parsed.\n \n+--is-well-formed-git-dir [path]::\n+\tCheck if [path] is a valid git-dir or a git-file pointing to a valid\n+\tgit-dir. If [path] is a valid git-dir the resolved path to git-dir will\n+\tbe printed.\n \n include::revisions.txt[]\n \ndiff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\nindex 4c19f84..82342b3 100644\n--- a/builtin/rev-parse.c\n+++ b/builtin/rev-parse.c\n@@ -455,6 +455,14 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)\n \tunsigned char sha1[20];\n \tconst char *name = NULL;\n \n+\tif (argc > 2 && !strcmp(argv[1], \"--is-well-formed-git-dir\")) {\n+\t\tconst char *gitdir = resolve_gitdir(argv[2]);\n+\t\tif(!gitdir)\n+\t\t\tdie(\"not a gitdir\");\n+\t\tputs(gitdir);\n+\t\treturn 0;\n+\t}\n+\n \tif (argc > 1 && !strcmp(\"--parseopt\", argv[1]))\n \t\treturn cmd_parseopt(argc - 1, argv + 1, prefix);\n \ndiff --git a/cache.h b/cache.h\nindex 9e12d55..550f632 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -436,6 +436,7 @@ extern char *get_graft_file(void);\n extern int set_git_dir(const char *path);\n extern const char *get_git_work_tree(void);\n extern const char *read_gitfile_gently(const char *path);\n+extern const char *resolve_gitdir(const char *suspect);\n extern void set_git_work_tree(const char *tree);\n \n #define ALTERNATE_DB_ENVIRONMENT \"GIT_ALTERNATE_OBJECT_DIRECTORIES\"\ndiff --git a/setup.c b/setup.c\nindex 5ea5502..15bc305 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -808,3 +808,10 @@ const char *setup_git_directory(void)\n {\n \treturn setup_git_directory_gently(NULL);\n }\n+\n+const char *resolve_gitdir(const char *suspect)\n+{\n+\tif(is_git_directory(suspect))\n+\t\treturn suspect;\n+\treturn read_gitfile_gently(suspect);\n+}\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex 14dc927..4df53e5 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -360,10 +360,10 @@ test_expect_success 'update --init' '\n \tgit submodule update init > update.out &&\n \tcat update.out &&\n \ttest_i18ngrep \"not initialized\" update.out &&\n-\t! test -d init/.git &&\n+\ttest_must_fail git rev-parse --is-well-formed-git-dir init/.git &&\n \n \tgit submodule update --init init &&\n-\ttest -d init/.git\n+\tgit rev-parse --is-well-formed-git-dir init/.git\n '\n \n test_expect_success 'do not add files from a submodule' '\ndiff --git a/t/t7403-submodule-sync.sh b/t/t7403-submodule-sync.sh\nindex 95ffe34..3620215 100755\n--- a/t/t7403-submodule-sync.sh\n+++ b/t/t7403-submodule-sync.sh\n@@ -56,8 +56,9 @@ test_expect_success '\"git submodule sync\" should update submodule URLs' '\n \t git pull --no-recurse-submodules &&\n \t git submodule sync\n \t) &&\n-\ttest -d \"$(git config -f super-clone/submodule/.git/config \\\n-\t                        remote.origin.url)\" &&\n+\ttest -d \"$(cd super-clone/submodule &&\n+\t git config remote.origin.url\n+\t)\" &&\n \t(cd super-clone/submodule &&\n \t git checkout master &&\n \t git pull\ndiff --git a/t/t7407-submodule-foreach.sh b/t/t7407-submodule-foreach.sh\nindex be745fb..1a974e2 100755\n--- a/t/t7407-submodule-foreach.sh\n+++ b/t/t7407-submodule-foreach.sh\n@@ -118,19 +118,19 @@ test_expect_success 'use \"submodule foreach\" to checkout 2nd level submodule' '\n \tgit clone super clone2 &&\n \t(\n \t\tcd clone2 &&\n-\t\ttest ! -d sub1/.git &&\n-\t\ttest ! -d sub2/.git &&\n-\t\ttest ! -d sub3/.git &&\n-\t\ttest ! -d nested1/.git &&\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir sub1/.git &&\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir sub2/.git &&\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir sub3/.git &&\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir nested1/.git &&\n \t\tgit submodule update --init &&\n-\t\ttest -d sub1/.git &&\n-\t\ttest -d sub2/.git &&\n-\t\ttest -d sub3/.git &&\n-\t\ttest -d nested1/.git &&\n-\t\ttest ! -d nested1/nested2/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir sub1/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir sub2/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir sub3/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/.git &&\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir nested1/nested2/.git &&\n \t\tgit submodule foreach \"git submodule update --init\" &&\n-\t\ttest -d nested1/nested2/.git &&\n-\t\ttest ! -d nested1/nested2/nested3/.git\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/nested1/nested2/.git\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir nested1/nested2/nested3/.git\n \t)\n '\n \n@@ -138,8 +138,8 @@ test_expect_success 'use \"foreach --recursive\" to checkout all submodules' '\n \t(\n \t\tcd clone2 &&\n \t\tgit submodule foreach --recursive \"git submodule update --init\" &&\n-\t\ttest -d nested1/nested2/nested3/.git &&\n-\t\ttest -d nested1/nested2/nested3/submodule/.git\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/nested2/nested3/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/nested2/nested3/submodule/.git\n \t)\n '\n \n@@ -183,18 +183,18 @@ test_expect_success 'use \"update --recursive\" to checkout all submodules' '\n \tgit clone super clone3 &&\n \t(\n \t\tcd clone3 &&\n-\t\ttest ! -d sub1/.git &&\n-\t\ttest ! -d sub2/.git &&\n-\t\ttest ! -d sub3/.git &&\n-\t\ttest ! -d nested1/.git &&\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir sub1/.git &&\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir sub2/.git &&\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir sub3/.git &&\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir nested1/.git &&\n \t\tgit submodule update --init --recursive &&\n-\t\ttest -d sub1/.git &&\n-\t\ttest -d sub2/.git &&\n-\t\ttest -d sub3/.git &&\n-\t\ttest -d nested1/.git &&\n-\t\ttest -d nested1/nested2/.git &&\n-\t\ttest -d nested1/nested2/nested3/.git &&\n-\t\ttest -d nested1/nested2/nested3/submodule/.git\n+\t\tgit rev-parse --is-well-formed-git-dir sub1/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir sub2/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir sub3/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/nested2/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/nested2/nested3/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/nested2/nested3/submodule/.git\n \t)\n '\n \n@@ -247,14 +247,17 @@ test_expect_success 'ensure \"status --cached --recursive\" preserves the --cached\n \n test_expect_success 'use \"git clone --recursive\" to checkout all submodules' '\n \tgit clone --recursive super clone4 &&\n-\ttest -d clone4/.git &&\n-\ttest -d clone4/sub1/.git &&\n-\ttest -d clone4/sub2/.git &&\n-\ttest -d clone4/sub3/.git &&\n-\ttest -d clone4/nested1/.git &&\n-\ttest -d clone4/nested1/nested2/.git &&\n-\ttest -d clone4/nested1/nested2/nested3/.git &&\n-\ttest -d clone4/nested1/nested2/nested3/submodule/.git\n+\t(\n+\t\tcd clone4 &&\n+\t\tgit rev-parse --is-well-formed-git-dir .git &&\n+\t\tgit rev-parse --is-well-formed-git-dir sub1/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir sub2/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir sub3/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/nested2/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/nested2/nested3/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/nested2/nested3/submodule/.git\n+\t)\n '\n \n test_expect_success 'test \"update --recursive\" with a flag with spaces' '\n@@ -262,11 +265,11 @@ test_expect_success 'test \"update --recursive\" with a flag with spaces' '\n \tgit clone super clone5 &&\n \t(\n \t\tcd clone5 &&\n-\t\ttest ! -d nested1/.git &&\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir d nested1/.git &&\n \t\tgit submodule update --init --recursive --reference=\"$(dirname \"$PWD\")/common objects\" &&\n-\t\ttest -d nested1/.git &&\n-\t\ttest -d nested1/nested2/.git &&\n-\t\ttest -d nested1/nested2/nested3/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/nested2/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/nested2/nested3/.git &&\n \t\ttest -f nested1/.git/objects/info/alternates &&\n \t\ttest -f nested1/nested2/.git/objects/info/alternates &&\n \t\ttest -f nested1/nested2/nested3/.git/objects/info/alternates\n@@ -277,18 +280,18 @@ test_expect_success 'use \"update --recursive nested1\" to checkout all submodules\n \tgit clone super clone6 &&\n \t(\n \t\tcd clone6 &&\n-\t\ttest ! -d sub1/.git &&\n-\t\ttest ! -d sub2/.git &&\n-\t\ttest ! -d sub3/.git &&\n-\t\ttest ! -d nested1/.git &&\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir sub1/.git &&\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir sub2/.git &&\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir sub3/.git &&\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir nested1/.git &&\n \t\tgit submodule update --init --recursive -- nested1 &&\n-\t\ttest ! -d sub1/.git &&\n-\t\ttest ! -d sub2/.git &&\n-\t\ttest ! -d sub3/.git &&\n-\t\ttest -d nested1/.git &&\n-\t\ttest -d nested1/nested2/.git &&\n-\t\ttest -d nested1/nested2/nested3/.git &&\n-\t\ttest -d nested1/nested2/nested3/submodule/.git\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir sub1/.git &&\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir sub2/.git &&\n+\t\ttest_must_fail git rev-parse --is-well-formed-git-dir sub3/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/nested2/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/nested2/nested3/.git &&\n+\t\tgit rev-parse --is-well-formed-git-dir nested1/nested2/nested3/submodule/.git\n \t)\n '\n \n-- \n1.7.6.398.g47bcd.dirty\n"},{"id":"173147","messageId":"1312831022-12868-3-git-send-email-iveqy@iveqy.com","threadId":"28047","inReplyTo":"1312831022-12868-1-git-send-email-iveqy@iveqy.com","subject":"[PATCH v2 2/2] Move git-dir for submodules","fromName":"Fredrik Gustafsson","fromEmail":"iveqy@iveqy.com","sentAt":"2011-08-08T19:17:02Z","receivedAt":"2011-08-08T19:17:02Z","isPatch":true,"sender":{"key":"iveqy@iveqy.com","avatar":"https://avatars.githubusercontent.com/u/761743?v=4"},"body":"Move git-dir for submodules into $GIT_DIR/modules/[name_of_submodule] of\nthe superproject. This is a step towards being able to delete submodule\ndirectories without loosing the information from their .git directory\nas that is now stored outside the submodules work tree.\n\nThis is done relying on the already existent .git-file functionality.\nWhen adding or updating a submodule whose git directory is found under\n$GIT_DIR/modules/[name_of_submodule], don't clone it again but simply\npoint the .git-file to it and remove the now stale index file from it.\n\nTests that rely on .git being a directory have been fixed.\n\nSigned-off-by: Fredrik Gustafsson <iveqy@iveqy.com>\nMentored-by: Jens Lehmann <Jens.Lehmann@web.de>\nMentored-by: Heiko Voigt <hvoigt@hvoigt.net>\n---\n git-submodule.sh               |   49 ++++++++++++++++--\n t/t7406-submodule-update.sh    |  107 ++++++++++++++++++++++++++++++++++++++++\n t/t7407-submodule-foreach.sh   |    6 +-\n t/t7408-submodule-reference.sh |    4 +-\n 4 files changed, 156 insertions(+), 10 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex bc1d3fa..ace6c1d 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -122,14 +122,53 @@ module_clone()\n \tpath=$1\n \turl=$2\n \treference=\"$3\"\n+\tgitdir=\n+\tgitdir_base=\n+\tname=$(module_name \"$path\")\n+\tif test -z \"$name\"\n+\tthen\n+\t\tname=\"$path\"\n+\tfi\n+\tbase_path=$(dirname \"$path\")\n+\n+\tgitdir=$(git rev-parse --git-dir)\n+\tgitdir_base=\"$gitdir/modules/$base_path\"\n+\tgitdir=\"$gitdir/modules/$path\"\n+\n+\tcase $gitdir in\n+\t/*)\n+\t\ta=\"$(cd_to_toplevel && pwd)/\"\n+\t\tb=$gitdir\n+\t\twhile [ \"$b\" ] && [ \"${a%%/*}\" = \"${b%%/*}\" ]\n+\t\tdo\n+\t\t\ta=${a#*/} b=${b#*/};\n+\t\tdone\n+\n+\t\trel=\"$a$name\"\n+\t\trel=`echo $rel | sed -e 's|[^/]*|..|g'`\n+\t\trel_gitdir=\"$rel/$b\"\n+\t\t;;\n+\t*)\n+\t\trel=`echo $name | sed -e 's|[^/]*|..|g'`\n+\t\trel_gitdir=\"$rel/$gitdir\"\n+\t\t;;\n+\tesac\n \n-\tif test -n \"$reference\"\n+\tif test -d \"$gitdir\"\n \tthen\n-\t\tgit-clone \"$reference\" -n \"$url\" \"$path\"\n+\t\tmkdir -p \"$path\"\n+\t\techo \"gitdir: $rel_gitdir\" >\"$path/.git\"\n+\t\trm -f \"$gitdir/index\"\n \telse\n-\t\tgit-clone -n \"$url\" \"$path\"\n-\tfi ||\n-\tdie \"$(eval_gettext \"Clone of '\\$url' into submodule path '\\$path' failed\")\"\n+\t\tmkdir -p \"$gitdir_base\"\n+\t\tif test -n \"$reference\"\n+\t\tthen\n+\t\t\tgit-clone \"$reference\" -n \"$url\" \"$path\" --separate-git-dir \"$gitdir\"\n+\t\telse\n+\t\t\tgit-clone -n \"$url\" \"$path\" --separate-git-dir \"$gitdir\"\n+\t\tfi ||\n+\t\tdie \"$(eval_gettext \"Clone of '\\$url' into submodule path '\\$path' failed\")\"\n+\tfi\n }\n \n #\ndiff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh\nindex c679f36..1ae6b4e 100755\n--- a/t/t7406-submodule-update.sh\n+++ b/t/t7406-submodule-update.sh\n@@ -408,6 +408,7 @@ test_expect_success 'submodule update exit immediately in case of merge conflict\n \t test_cmp expect actual\n \t)\n '\n+\n test_expect_success 'submodule update exit immediately after recursive rebase error' '\n \t(cd super &&\n \t git checkout master &&\n@@ -442,4 +443,110 @@ test_expect_success 'submodule update exit immediately after recursive rebase er\n \t test_cmp expect actual\n \t)\n '\n+\n+test_expect_success 'add different submodules to the same path' '\n+\t(cd super &&\n+\t git submodule add ../submodule s1 &&\n+\t test_must_fail git submodule add ../merging s1\n+\t)\n+'\n+\n+test_expect_success 'submodule add places git-dir in superprojects git-dir' '\n+\t(cd super &&\n+\t mkdir deeper &&\n+\t git submodule add ../submodule deeper/submodule &&\n+\t (cd deeper/submodule &&\n+\t  git log > ../../expected\n+\t ) &&\n+\t (cd .git/modules/deeper/submodule &&\n+\t  git log > ../../../../actual\n+\t ) &&\n+\t test_cmp actual expected\n+\t)\n+'\n+\n+test_expect_success 'submodule update places git-dir in superprojects git-dir' '\n+\t(cd super &&\n+\t git commit -m \"added submodule\"\n+\t) &&\n+\tgit clone super super2 &&\n+\t(cd super2 &&\n+\t git submodule init deeper/submodule &&\n+\t git submodule update &&\n+\t (cd deeper/submodule &&\n+\t  git log > ../../expected\n+\t ) &&\n+\t (cd .git/modules/deeper/submodule &&\n+\t  git log > ../../../../actual\n+\t ) &&\n+\t test_cmp actual expected\n+\t)\n+'\n+\n+test_expect_success 'submodule add places git-dir in superprojects git-dir recursive' '\n+\t(cd super2 &&\n+\t (cd deeper/submodule &&\n+\t  git submodule add ../submodule subsubmodule &&\n+\t  (cd subsubmodule &&\n+\t   git log > ../../../expected\n+\t  ) &&\n+\t  git commit -m \"added subsubmodule\" &&\n+\t  git push\n+\t ) &&\n+\t (cd .git/modules/deeper/submodule/modules/subsubmodule &&\n+\t  git log > ../../../../../actual\n+\t ) &&\n+\t git add deeper/submodule &&\n+\t git commit -m \"update submodule\" &&\n+\t git push &&\n+\t test_cmp actual expected\n+\t)\n+'\n+\n+test_expect_success 'submodule update places git-dir in superprojects git-dir recursive' '\n+\tmkdir super_update_r &&\n+\t(cd super_update_r &&\n+\t git init --bare\n+\t) &&\n+\tmkdir subsuper_update_r &&\n+\t(cd subsuper_update_r &&\n+\t git init --bare\n+\t) &&\n+\tmkdir subsubsuper_update_r &&\n+\t(cd subsubsuper_update_r &&\n+\t git init --bare\n+\t) &&\n+\tgit clone subsubsuper_update_r subsubsuper_update_r2 &&\n+\t(cd subsubsuper_update_r2 &&\n+\t test_commit \"update_subsubsuper\" file &&\n+\t git push origin master\n+\t) &&\n+\tgit clone subsuper_update_r subsuper_update_r2 &&\n+\t(cd subsuper_update_r2 &&\n+\t test_commit \"update_subsuper\" file &&\n+\t git submodule add ../subsubsuper_update_r subsubmodule &&\n+\t git commit -am \"subsubmodule\" &&\n+\t git push origin master\n+\t) &&\n+\tgit clone super_update_r super_update_r2 &&\n+\t(cd super_update_r2 &&\n+\t test_commit \"update_super\" file &&\n+\t git submodule add ../subsuper_update_r submodule &&\n+\t git commit -am \"submodule\" &&\n+\t git push origin master\n+\t) &&\n+\trm -rf super_update_r2 &&\n+\tgit clone super_update_r super_update_r2 &&\n+\t(cd super_update_r2 &&\n+\t git submodule update --init --recursive &&\n+\t (cd submodule/subsubmodule &&\n+\t  git log > ../../expected\n+\t ) &&\n+\t (cd .git/modules/submodule/modules/subsubmodule\n+\t  git log > ../../../../../actual\n+\t )\n+\t test_cmp actual expected\n+\t)\n+'\n+\n test_done\ndiff --git a/t/t7407-submodule-foreach.sh b/t/t7407-submodule-foreach.sh\nindex 1a974e2..e410bd4 100755\n--- a/t/t7407-submodule-foreach.sh\n+++ b/t/t7407-submodule-foreach.sh\n@@ -270,9 +270,9 @@ test_expect_success 'test \"update --recursive\" with a flag with spaces' '\n \t\tgit rev-parse --is-well-formed-git-dir nested1/.git &&\n \t\tgit rev-parse --is-well-formed-git-dir nested1/nested2/.git &&\n \t\tgit rev-parse --is-well-formed-git-dir nested1/nested2/nested3/.git &&\n-\t\ttest -f nested1/.git/objects/info/alternates &&\n-\t\ttest -f nested1/nested2/.git/objects/info/alternates &&\n-\t\ttest -f nested1/nested2/nested3/.git/objects/info/alternates\n+\t\ttest -f .git/modules/nested1/objects/info/alternates &&\n+\t\ttest -f .git/modules/nested1/modules/nested2/objects/info/alternates &&\n+\t\ttest -f .git/modules/nested1/modules/nested2/modules/nested3/objects/info/alternates\n \t)\n '\n \ndiff --git a/t/t7408-submodule-reference.sh b/t/t7408-submodule-reference.sh\nindex cc16d3f..ab37c36 100755\n--- a/t/t7408-submodule-reference.sh\n+++ b/t/t7408-submodule-reference.sh\n@@ -43,7 +43,7 @@ git commit -m B-super-added'\n cd \"$base_dir\"\n \n test_expect_success 'after add: existence of info/alternates' \\\n-'test `wc -l <super/sub/.git/objects/info/alternates` = 1'\n+'test `wc -l <super/.git/modules/sub/objects/info/alternates` = 1'\n \n cd \"$base_dir\"\n \n@@ -66,7 +66,7 @@ test_expect_success 'update with reference' \\\n cd \"$base_dir\"\n \n test_expect_success 'after update: existence of info/alternates' \\\n-'test `wc -l <super-clone/sub/.git/objects/info/alternates` = 1'\n+'test `wc -l <super-clone/.git/modules/sub/objects/info/alternates` = 1'\n \n cd \"$base_dir\"\n \n-- \n1.7.6.398.g47bcd.dirty\n"},{"id":"173155","messageId":"20110808204439.GA41500@book.hvoigt.net","threadId":"28047","inReplyTo":"1312831022-12868-3-git-send-email-iveqy@iveqy.com","subject":"Re: [PATCH v2 2/2] Move git-dir for submodules","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2011-08-08T20:44:40Z","receivedAt":"2011-08-08T20:44:40Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"Hi,\n\nOn Mon, Aug 08, 2011 at 09:17:02PM +0200, Fredrik Gustafsson wrote:\n> diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh\n> index c679f36..1ae6b4e 100755\n> --- a/t/t7406-submodule-update.sh\n> +++ b/t/t7406-submodule-update.sh\n> @@ -408,6 +408,7 @@ test_expect_success 'submodule update exit immediately in case of merge conflict\n>  \t test_cmp expect actual\n>  \t)\n>  '\n> +\n\nThere is a whitespace error here which we seem to have overlooked. Junio\ncould you remove that?\n\n>  test_expect_success 'submodule update exit immediately after recursive rebase error' '\n>  \t(cd super &&\n>  \t git checkout master &&\n\nCheers Heiko\n"},{"id":"173167","messageId":"7v1uwvwpsk.fsf@alter.siamese.dyndns.org","threadId":"28047","inReplyTo":"20110808204439.GA41500@book.hvoigt.net","subject":"Re: [PATCH v2 2/2] Move git-dir for submodules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-08T21:34:35Z","receivedAt":"2011-08-08T21:34:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Heiko Voigt <hvoigt@hvoigt.net> writes:\n\n> Hi,\n>\n> On Mon, Aug 08, 2011 at 09:17:02PM +0200, Fredrik Gustafsson wrote:\n>> diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh\n>> index c679f36..1ae6b4e 100755\n>> --- a/t/t7406-submodule-update.sh\n>> +++ b/t/t7406-submodule-update.sh\n>> @@ -408,6 +408,7 @@ test_expect_success 'submodule update exit immediately in case of merge conflict\n>>  \t test_cmp expect actual\n>>  \t)\n>>  '\n>> +\n>\n> There is a whitespace error here which we seem to have overlooked. Junio\n> could you remove that?\n\nHmm, confused.\n\nA blank between test would be the perfectly normal thing to see, no?\n\n>>  test_expect_success 'submodule update exit immediately after recursive rebase error' '\n>>  \t(cd super &&\n>>  \t git checkout master &&\n>\n> Cheers Heiko\n"},{"id":"173213","messageId":"20110809182332.GD42153@book.hvoigt.net","threadId":"28047","inReplyTo":"7v1uwvwpsk.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 2/2] Move git-dir for submodules","fromName":"Heiko Voigt","fromEmail":"hvoigt@hvoigt.net","sentAt":"2011-08-09T18:23:33Z","receivedAt":"2011-08-09T18:23:33Z","isPatch":true,"sender":{"key":"hvoigt@hvoigt.net","avatar":"https://avatars.githubusercontent.com/u/184958?v=4"},"body":"Hi,\n\nOn Mon, Aug 08, 2011 at 02:34:35PM -0700, Junio C Hamano wrote:\n> Heiko Voigt <hvoigt@hvoigt.net> writes:\n> \n> > Hi,\n> >\n> > On Mon, Aug 08, 2011 at 09:17:02PM +0200, Fredrik Gustafsson wrote:\n> >> diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh\n> >> index c679f36..1ae6b4e 100755\n> >> --- a/t/t7406-submodule-update.sh\n> >> +++ b/t/t7406-submodule-update.sh\n> >> @@ -408,6 +408,7 @@ test_expect_success 'submodule update exit immediately in case of merge conflict\n> >>  \t test_cmp expect actual\n> >>  \t)\n> >>  '\n> >> +\n> >\n> > There is a whitespace error here which we seem to have overlooked. Junio\n> > could you remove that?\n> \n> Hmm, confused.\n> \n> A blank between test would be the perfectly normal thing to see, no?\n\nYes indeed you are right I did just see the lonely new line here. I\nmissed that a blank line was missing previously here.\n\nCheers Heiko\n"},{"id":"173325","messageId":"7v62m3plnx.fsf@alter.siamese.dyndns.org","threadId":"28047","inReplyTo":"1312831022-12868-2-git-send-email-iveqy@iveqy.com","subject":"Re: [PATCH v2 1/2] rev-parse: add option --is-well-formed-git-dir [path]","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-11T23:34:42Z","receivedAt":"2011-08-11T23:34:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Fredrik Gustafsson <iveqy@iveqy.com> writes:\n\n> diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c\n> index 4c19f84..82342b3 100644\n> --- a/builtin/rev-parse.c\n> +++ b/builtin/rev-parse.c\n> @@ -455,6 +455,14 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)\n>  \tunsigned char sha1[20];\n>  \tconst char *name = NULL;\n>  \n> +\tif (argc > 2 && !strcmp(argv[1], \"--is-well-formed-git-dir\")) {\n> +\t\tconst char *gitdir = resolve_gitdir(argv[2]);\n> +\t\tif(!gitdir)\n\n(style) SP immediately after \"if\".\n\n> +\t\t\tdie(\"not a gitdir\");\n\ndie(\"not a gitdir '%s'\", argv[2]) perhaps?\n\n> +\t\tputs(gitdir);\n> +\t\treturn 0;\n> +\t}\n> +\n>  \tif (argc > 1 && !strcmp(\"--parseopt\", argv[1]))\n>  \t\treturn cmd_parseopt(argc - 1, argv + 1, prefix);\n\nWhen adding a new element to existing list of other similar things, I\nwould prefer to see it added at the end (in this case, just before \"-h\",\nwhich is kind of special), unless there is a good justification not to\n(e.g. the list is sorted alphabetically).\n\n> diff --git a/setup.c b/setup.c\n> index 5ea5502..15bc305 100644\n> --- a/setup.c\n> +++ b/setup.c\n> @@ -808,3 +808,10 @@ const char *setup_git_directory(void)\n>  {\n>  \treturn setup_git_directory_gently(NULL);\n>  }\n> +\n> +const char *resolve_gitdir(const char *suspect)\n> +{\n> +\tif(is_git_directory(suspect))\n\n(style) SP immediately after \"if\".\n"},{"id":"173326","messageId":"7vy5yzo736.fsf@alter.siamese.dyndns.org","threadId":"28047","inReplyTo":"1312831022-12868-3-git-send-email-iveqy@iveqy.com","subject":"Re: [PATCH v2 2/2] Move git-dir for submodules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-11T23:34:53Z","receivedAt":"2011-08-11T23:34:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Fredrik Gustafsson <iveqy@iveqy.com> writes:\n\n> Move git-dir for submodules into $GIT_DIR/modules/[name_of_submodule] of\n> the superproject. This is a step towards being able to delete submodule\n> directories without loosing the information from their .git directory\n> as that is now stored outside the submodules work tree.\n>\n> This is done relying on the already existent .git-file functionality.\n> When adding or updating a submodule whose git directory is found under\n> $GIT_DIR/modules/[name_of_submodule], don't clone it again but simply\n> point the .git-file to it and remove the now stale index file from it.\n\nAnd the index is populated to match the correct commit how?\n\n> Tests that rely on .git being a directory have been fixed.\n\nThanks.\n\nHow would this interact with submodule repositories that are already\ninitialized in-place?\n"}]}