{"thread":{"id":"22914","subject":"[PATCH] t7406: Fix submodule init config tests","startedAt":"2010-03-05T08:20:38Z","lastAt":"2010-03-07T04:00:55Z","messageCount":2,"participants":["Stephen Boyd","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"136187","messageId":"1267777238-2646-1-git-send-email-bebarino@gmail.com","threadId":"22914","inReplyTo":null,"subject":"[PATCH] t7406: Fix submodule init config tests","fromName":"Stephen Boyd","fromEmail":"bebarino@gmail.com","sentAt":"2010-03-05T08:20:38Z","receivedAt":"2010-03-05T08:20:38Z","isPatch":true,"sender":{"key":"bebarino@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38832?v=4"},"body":"These tests have been broken since they were introduced in commits\nca2cedb (git-submodule: add support for --rebase., 2009-04-24) and\n42b4917 (git-submodule: add support for --merge., 2009-06-03).\n'git submodule init' expects the submodules to exist in the index.\nIn this case, the submodules don't exist and therefore looking for\nthe submodules will always fail. To make matters worse, git submodule\nfails visibly to the user by saying:\n\nerror: pathspec 'rebasing' did not match any file(s) known to git.\nDid you forget to 'git add'?\n\nbut doesn't return an error code. This allows the test to fail silently.\nFix it by adding the submodules first.\n\nCc: Johan Herland <johan@herland.net>\nCc: Peter Hutterer <peter.hutterer@who-t.net>\nCc: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Stephen Boyd <bebarino@gmail.com>\n---\n\nThe documentation for submodule init is a bit misleading too. It sounds\nlike submodule init will just read the .gitmodules file and copy settings\nto the .git/config, but it actually needs the submodules in the index to\ncopy anything.\n\nShould the behavior of submodule init should change to match the docs?\n\n t/t7406-submodule-update.sh |   24 ++++++++++++++++--------\n 1 files changed, 16 insertions(+), 8 deletions(-)\n\ndiff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh\nindex 8e2449d..1382a8e 100755\n--- a/t/t7406-submodule-update.sh\n+++ b/t/t7406-submodule-update.sh\n@@ -28,6 +28,8 @@ test_expect_success 'setup a submodule tree' '\n \tgit commit -m upstream\n \tgit clone . super &&\n \tgit clone super submodule &&\n+\tgit clone super rebasing &&\n+\tgit clone super merging &&\n \t(cd super &&\n \t git submodule add ../submodule submodule &&\n \t test_tick &&\n@@ -45,6 +47,16 @@ test_expect_success 'setup a submodule tree' '\n \t ) &&\n \t git add submodule &&\n \t git commit -m \"submodule update\"\n+\t) &&\n+\t(cd super &&\n+\t git submodule add ../rebasing rebasing &&\n+\t test_tick &&\n+\t git commit -m \"rebasing\"\n+\t) &&\n+\t(cd super &&\n+\t git submodule add ../merging merging &&\n+\t test_tick &&\n+\t git commit -m \"rebasing\"\n \t)\n '\n \n@@ -177,21 +189,17 @@ test_expect_success 'submodule update - checkout in .git/config' '\n \n test_expect_success 'submodule init picks up rebase' '\n \t(cd super &&\n-\t git config submodule.rebasing.url git://non-existing/git &&\n-\t git config submodule.rebasing.path does-not-matter &&\n-\t git config submodule.rebasing.update rebase &&\n+\t git config -f .gitmodules submodule.rebasing.update rebase &&\n \t git submodule init rebasing &&\n-\t test \"rebase\" = $(git config submodule.rebasing.update)\n+\t test \"rebase\" = \"$(git config submodule.rebasing.update)\"\n \t)\n '\n \n test_expect_success 'submodule init picks up merge' '\n \t(cd super &&\n-\t git config submodule.merging.url git://non-existing/git &&\n-\t git config submodule.merging.path does-not-matter &&\n-\t git config submodule.merging.update merge &&\n+\t git config -f .gitmodules submodule.merging.update merge &&\n \t git submodule init merging &&\n-\t test \"merge\" = $(git config submodule.merging.update)\n+\t test \"merge\" = \"$(git config submodule.merging.update)\"\n \t)\n '\n \n-- \n1.7.0.1.138.ga75b\n"},{"id":"136269","messageId":"7v6358bx1k.fsf@alter.siamese.dyndns.org","threadId":"22914","inReplyTo":"1267777238-2646-1-git-send-email-bebarino@gmail.com","subject":"Re: [PATCH] t7406: Fix submodule init config tests","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-07T04:00:55Z","receivedAt":"2010-03-07T04:00:55Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n"}]}