{"thread":{"id":"18002","subject":"Fwd: Git Submodule Misbehaviour With ./","startedAt":"2009-02-24T23:56:20Z","lastAt":"2009-03-03T16:32:02Z","messageCount":35,"participants":["Andrei Thorp","Michael J Gruber","Johannes Sixt","Junio C Hamano","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"106125","messageId":"80055d7c0902241556s4d24285bqd171275f58bdb37d@mail.gmail.com","threadId":"18002","inReplyTo":"80055d7c0902241541o5c8fad50ra4eace5919bcf6df@mail.gmail.com","subject":"Fwd: Git Submodule Misbehaviour With ./","fromName":"Andrei Thorp","fromEmail":"garoth@gmail.com","sentAt":"2009-02-24T23:56:20Z","receivedAt":"2009-02-24T23:56:20Z","isPatch":false,"sender":{"key":"garoth@gmail.com","avatar":null},"body":"Hello,\n\nGit (I have version 1.6.1.3) seems to misbehave when it comes to git\nsubmodule add and ./. Here is an example.\n\n================================================\n$ cd Configs\n$ git submodule add git@git.mercenariesguild.net:obvious.git ./awesome/obvious\nInitialized empty Git repository in /home/garoth/Configs/awesome/obvious/.git/\nstdin: is not a tty\nremote: Counting objects: 32, done.\nremote: Compressing objects: 100% (29/29), done.\nReceiving objects: 100% (32/32), 5.10 KiB, done.\nremote: Total 32 (delta 8), reused 0 (delta 0)\nResolving deltas: 100% (8/8), done.\n$ git submodule init\nNo submodule mapping found in .gitmodules for path 'awesome/obvious'\n$ git commit -m \"Added obvious submodule\"\n$ cd ~/Desktop\n$ git clone ~/Configs\n$ git submodule init\nNo submodule mapping found in .gitmodules for path 'awesome/obvious'\n================================================\n\nNote how when I did git submodule add, I used ./awesome/obvious. The behaviour\nof \"No submodule mapping found in .gitmodules for path 'awesome/obvious'\" only\noccurs when you use ./. If I were to use:\n\n$ git submodule add git@git.mercenariesguild.net:obvious.git awesome/obvious\n\ninstead, then git handles everything just fine. Thanks to dsal in #git\nfor helping me\nfigure this out. Perhaps there is an error with regards to how the\n.gitmodules file\nis parsed or encoded. I'm not really a git developer, but I wanted to\nhave this issue\ndocumented at least somewhere.\n\nThanks,\n\n-Andrei Thorp\n"},{"id":"106208","messageId":"1235559820-3096-1-git-send-email-git@drmicha.warpmail.net","threadId":"18002","inReplyTo":"80055d7c0902241556s4d24285bqd171275f58bdb37d@mail.gmail.com","subject":"[PATCH 0/2] Fix git submodule add for paths with ./","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-02-25T11:03:38Z","receivedAt":"2009-02-25T11:03:38Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"As reported by Andrei Thorp <garoth@gmail.com>, git submodule add does\nnot work with paths containing './'. This series exposes the problem\nwith tests and fixes it. (For details see the commit messages.)\n\nOn a side note: There were no tests at all so far for git submodule add.\nNow there are at least two, but there should be more, especially for\nadding repos in place and such.\n\nMichael J Gruber (2):\n  git submodule: Add test cases for git submodule add\n  git submodule: Fix adding of submodules at paths with ./\n\n git-submodule.sh           |    3 +++\n t/t7400-submodule-basic.sh |   19 +++++++++++++++++++\n 2 files changed, 22 insertions(+), 0 deletions(-)\n"},{"id":"106209","messageId":"1235559820-3096-2-git-send-email-git@drmicha.warpmail.net","threadId":"18002","inReplyTo":"1235559820-3096-1-git-send-email-git@drmicha.warpmail.net","subject":"[PATCH 1/2] git submodule: Add test cases for git submodule add","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-02-25T11:03:39Z","receivedAt":"2009-02-25T11:03:39Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Add two simple test cases for adding and initialising submodules. The\ninit step is necessary in order to verify the added information.\n\nThe second test exposes a known breakage due to './' in the path: git\nls-files simplifies the path but git add does not, which leads to git\ninit looking for different lines in .gitmodules than git add adds.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\nNote: Tests for add and init are somewhat interdependent in the sense\nthat you need either in order to test success for the other. I put the\nadd tests first because you need to add a submodule before you can init\nit.\n\n t/t7400-submodule-basic.sh |   19 +++++++++++++++++++\n 1 files changed, 19 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex b8cb2df..b154050 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -47,6 +47,25 @@ test_expect_success 'Prepare submodule testing' '\n \tGIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/init.git\n '\n \n+test_expect_success 'Prepare submodule add testing' '\n+\tsubmodurl=$(pwd)\n+\tmkdir addtest &&\n+\tpushd addtest &&\n+\tgit init\n+'\n+\n+test_expect_success 'submodule add' '\n+\tgit submodule add \"$submodurl\" submod &&\n+\tgit submodule init\n+'\n+\n+test_expect_failure 'submodule add with ./ in path' '\n+\tgit submodule add \"$submodurl\" ././dotsubmod/./frotz/./ &&\n+\tgit submodule init\n+'\n+# end of submodule add testing\n+popd >/dev/null\n+\n test_expect_success 'status should fail for unmapped paths' '\n \tif git submodule status\n \tthen\n-- \n1.6.2.rc1.30.gd43c\n"},{"id":"106207","messageId":"1235559820-3096-3-git-send-email-git@drmicha.warpmail.net","threadId":"18002","inReplyTo":"1235559820-3096-2-git-send-email-git@drmicha.warpmail.net","subject":"[PATCH 2/2] git submodule: Fix adding of submodules at paths with ./","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-02-25T11:03:40Z","receivedAt":"2009-02-25T11:03:40Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Make 'git submodule add' strip './' from the submodule path in the same\nway as 'git ls-files' does, so that 'git submodule init' looks up the\ninformation in .gitmodules with the same key under which 'git submodule\nadd' stores it.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n git-submodule.sh           |    3 +++\n t/t7400-submodule-basic.sh |    2 +-\n 2 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 204aab6..4f26be4 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -167,6 +167,9 @@ cmd_add()\n \t;;\n \tesac\n \n+\t# strip superfluous ./ from path\n+\tpath=$(echo \"$path\" | sed -e 's|^\\(\\./\\)*||' -e's|/\\./|/|g')\n+\n \t# strip trailing slashes from path\n \tpath=$(echo \"$path\" | sed -e 's|/*$||')\n \ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex b154050..1757732 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -59,7 +59,7 @@ test_expect_success 'submodule add' '\n \tgit submodule init\n '\n \n-test_expect_failure 'submodule add with ./ in path' '\n+test_expect_success 'submodule add with ./ in path' '\n \tgit submodule add \"$submodurl\" ././dotsubmod/./frotz/./ &&\n \tgit submodule init\n '\n-- \n1.6.2.rc1.30.gd43c\n"},{"id":"106211","messageId":"49A529AB.8010700@viscovery.net","threadId":"18002","inReplyTo":"1235559820-3096-3-git-send-email-git@drmicha.warpmail.net","subject":"Re: [PATCH 2/2] git submodule: Fix adding of submodules at paths with ./","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-02-25T11:21:15Z","receivedAt":"2009-02-25T11:21:15Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Michael J Gruber schrieb:\n> +\t# strip superfluous ./ from path\n> +\tpath=$(echo \"$path\" | sed -e 's|^\\(\\./\\)*||' -e's|/\\./|/|g')\n\nAt a minimum:\n\n\tpath=$(echo \"$path\" | sed -e 's|^/\\(\\./\\)*|/|g' -e's|^\\./||')\n\nOtherwise you would turn \"foo./bar\" into \"foobar\", right?\n\nBut why only care about ./ but not ../ or /// or trailing / as well?\n\n-- Hannes\n"},{"id":"106212","messageId":"49A53B15.4060608@drmicha.warpmail.net","threadId":"18002","inReplyTo":"49A529AB.8010700@viscovery.net","subject":"Re: [PATCH 2/2] git submodule: Fix adding of submodules at paths with ./","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-02-25T12:35:33Z","receivedAt":"2009-02-25T12:35:33Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Johannes Sixt venit, vidit, dixit 25.02.2009 12:21:\n> Michael J Gruber schrieb:\n>> +\t# strip superfluous ./ from path\n>> +\tpath=$(echo \"$path\" | sed -e 's|^\\(\\./\\)*||' -e's|/\\./|/|g')\n> \n> At a minimum:\n> \n> \tpath=$(echo \"$path\" | sed -e 's|^/\\(\\./\\)*|/|g' -e's|^\\./||')\n> \n> Otherwise you would turn \"foo./bar\" into \"foobar\", right?\n\nWrong.\n\nMy regexp:\necho \"foo./bar\"  | sed -e 's|^\\(\\./\\)*||' -e's|/\\./|/|g'\nfoo./bar\n\necho \"foo/./bar\" | sed -e 's|^\\(\\./\\)*||' -e's|/\\./|/|g'\nfoo/bar\n\n\nYour regexp:\necho \"foo./bar\"  | sed -e 's|^/\\(\\./\\)*|/|g' -e's|^\\./||'\nfoo./bar\n\necho \"foo/./bar\" | sed -e 's|^/\\(\\./\\)*|/|g' -e's|^\\./||'\nfoo/./bar\n\nTesting your claim isn't that hard to do before hand...\n\n> But why only care about ./ but not ../ or /// or trailing / as well?\n\nYou really haven't even looked at the included context of the patch\n(which you stripped), have you? I mean, I'm open for suggestions and\ncriticism, but please don't shoot blindly.\n\n./ have been reported and are a common use case.\n\nTrailing / are dealt with by the code (see context).\n\nNow, the /// are in fact a valid concern[1], although probably not that\ncommon an isue. If we really want to cater for that (and more) we need\nto implement normalize_path_copy() (from path.c). There it says:\n\n* Performs the following normalizations on src, storing the result in dst:\n * - Ensures that components are separated by '/' (Windows only)\n * - Squashes sequences of '/'.\n * - Removes \".\" components.\n * - Removes \"..\" components, and the components the precede them.\n * Returns failure (non-zero) if a \"..\" component appears as first path\n * component anytime during the normalization. Otherwise, returns\nsuccess (0).\n\nOK, two more regexps for sed. Thanks, I don't need suggestions for the\nregexps ;)\n\nI can add /// and .. testing and handling in a v2, but I'll definitely\nleave the Windoze paths to someone who can actually test on Win.\n\nMichael\n\n[1] git sm init uses git ls-files, which in turn,..., which calls\nnormalize_path_copy. git sm add can't use git ls-files because it has to\ndeal with an as yet unknown path.\n"},{"id":"106214","messageId":"49A541D3.4030001@viscovery.net","threadId":"18002","inReplyTo":"49A53B15.4060608@drmicha.warpmail.net","subject":"Re: [PATCH 2/2] git submodule: Fix adding of submodules at paths with ./","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-02-25T13:04:19Z","receivedAt":"2009-02-25T13:04:19Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Michael J Gruber schrieb:\n> Johannes Sixt venit, vidit, dixit 25.02.2009 12:21:\n>> Michael J Gruber schrieb:\n>>> +\t# strip superfluous ./ from path\n>>> +\tpath=$(echo \"$path\" | sed -e 's|^\\(\\./\\)*||' -e's|/\\./|/|g')\n>> At a minimum:\n>>\n>> \tpath=$(echo \"$path\" | sed -e 's|^/\\(\\./\\)*|/|g' -e's|^\\./||')\n>>\n>> Otherwise you would turn \"foo./bar\" into \"foobar\", right?\n> \n> Wrong.\n\nOuch! Point taken. I didn't notice the ^ in the first expression, and I\neven copy-pasted and edited it!\n\n> Now, the /// are in fact a valid concern[1], although probably not that\n> common an isue.\n\nI'm fine if only common use cases are taken care of. If you say that ./ is\ncommon and /// is not, then I'll believe it because I'm not a git\nsubmodule user (yet) and can't argue about this with my own experience.\n\n-- Hannes\n"},{"id":"106215","messageId":"1235568392-19705-1-git-send-email-git@drmicha.warpmail.net","threadId":"18002","inReplyTo":"49A541D3.4030001@viscovery.net","subject":"[PATCHv2 0/4] Fix git submodule add for funky paths","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-02-25T13:26:28Z","receivedAt":"2009-02-25T13:26:28Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"As reported by Andrei Thorp <garoth@gmail.com>, git submodule add does\nnot work with paths containing './'. This series exposes the problem\nwith tests and fixes it. (For details see the commit messages.)\n\nOn a side note: There were no tests at all so far for git submodule add.\nNow there are at least two, but there should be more, especially for\nadding repos in place and such.\n\nv2 adds 2 more tests for paths with // and /.. and helps g sm add pass the tests.\n\nMichael J Gruber (4):\n  git submodule: Add test cases for git submodule add\n  git submodule: Fix adding of submodules at paths with ./\n  git submodule: Add more tests for add with funky paths\n  git submodule: Fix handling of // and /.. in paths for added\n    submodules\n\n git-submodule.sh           |    9 +++++++++\n t/t7400-submodule-basic.sh |   29 +++++++++++++++++++++++++++++\n 2 files changed, 38 insertions(+), 0 deletions(-)\n"},{"id":"106216","messageId":"1235568392-19705-2-git-send-email-git@drmicha.warpmail.net","threadId":"18002","inReplyTo":"1235568392-19705-1-git-send-email-git@drmicha.warpmail.net","subject":"[PATCHv2 1/4] git submodule: Add test cases for git submodule add","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-02-25T13:26:29Z","receivedAt":"2009-02-25T13:26:29Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Add two simple test cases for adding and initialising submodules. The\ninit step is necessary in order to verify the added information.\n\nThe second test exposes a known breakage due to './' in the path: git\nls-files simplifies the path but git add does not, which leads to git\ninit looking for different lines in .gitmodules than git add adds.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\nNote: Tests for add and init are somewhat interdependent in the sense\nthat you need either in order to test success for the other. I put the\nadd tests first because you need to add a submodule before you can init\nit.\n\n t/t7400-submodule-basic.sh |   19 +++++++++++++++++++\n 1 files changed, 19 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex b8cb2df..b154050 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -47,6 +47,25 @@ test_expect_success 'Prepare submodule testing' '\n \tGIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/init.git\n '\n \n+test_expect_success 'Prepare submodule add testing' '\n+\tsubmodurl=$(pwd)\n+\tmkdir addtest &&\n+\tpushd addtest &&\n+\tgit init\n+'\n+\n+test_expect_success 'submodule add' '\n+\tgit submodule add \"$submodurl\" submod &&\n+\tgit submodule init\n+'\n+\n+test_expect_failure 'submodule add with ./ in path' '\n+\tgit submodule add \"$submodurl\" ././dotsubmod/./frotz/./ &&\n+\tgit submodule init\n+'\n+# end of submodule add testing\n+popd >/dev/null\n+\n test_expect_success 'status should fail for unmapped paths' '\n \tif git submodule status\n \tthen\n-- \n1.6.2.rc1.30.gd43c\n"},{"id":"106217","messageId":"1235568392-19705-3-git-send-email-git@drmicha.warpmail.net","threadId":"18002","inReplyTo":"1235568392-19705-2-git-send-email-git@drmicha.warpmail.net","subject":"[PATCHv2 2/4] git submodule: Fix adding of submodules at paths with ./","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-02-25T13:26:30Z","receivedAt":"2009-02-25T13:26:30Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Make 'git submodule add' strip './' from the submodule path in the same\nway as 'git ls-files' does, so that 'git submodule init' looks up the\ninformation in .gitmodules with the same key under which 'git submodule\nadd' stores it.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\nNote that the init step implicitly tests whether add recorded the correct path.\n \n   git-submodule.sh           |    3 +++\n t/t7400-submodule-basic.sh |    2 +-\n 2 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 204aab6..4f26be4 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -167,6 +167,9 @@ cmd_add()\n \t;;\n \tesac\n \n+\t# strip superfluous ./ from path\n+\tpath=$(echo \"$path\" | sed -e 's|^\\(\\./\\)*||' -e's|/\\./|/|g')\n+\n \t# strip trailing slashes from path\n \tpath=$(echo \"$path\" | sed -e 's|/*$||')\n \ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex b154050..1757732 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -59,7 +59,7 @@ test_expect_success 'submodule add' '\n \tgit submodule init\n '\n \n-test_expect_failure 'submodule add with ./ in path' '\n+test_expect_success 'submodule add with ./ in path' '\n \tgit submodule add \"$submodurl\" ././dotsubmod/./frotz/./ &&\n \tgit submodule init\n '\n-- \n1.6.2.rc1.30.gd43c\n"},{"id":"106218","messageId":"1235568392-19705-4-git-send-email-git@drmicha.warpmail.net","threadId":"18002","inReplyTo":"1235568392-19705-3-git-send-email-git@drmicha.warpmail.net","subject":"[PATCHv2 3/4] git submodule: Add more tests for add with funky paths","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-02-25T13:26:31Z","receivedAt":"2009-02-25T13:26:31Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Add 2 more tests which test paths with // and /.., both of which fail\ncurrently.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n t/t7400-submodule-basic.sh |   10 ++++++++++\n 1 files changed, 10 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex 1757732..21bdfeb 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -63,6 +63,16 @@ test_expect_success 'submodule add with ./ in path' '\n \tgit submodule add \"$submodurl\" ././dotsubmod/./frotz/./ &&\n \tgit submodule init\n '\n+\n+test_expect_failure 'submodule add with // in path' '\n+\tgit submodule add \"$submodurl\" slashslashsubmod///frotz// &&\n+\tgit submodule init\n+'\n+\n+test_expect_failure 'submodule add with /.. in path' '\n+\tgit submodule add \"$submodurl\" dotdotsubmod/../realsubmod/frotz/.. &&\n+\tgit submodule init\n+'\n # end of submodule add testing\n popd >/dev/null\n \n-- \n1.6.2.rc1.30.gd43c\n"},{"id":"106219","messageId":"1235568392-19705-5-git-send-email-git@drmicha.warpmail.net","threadId":"18002","inReplyTo":"1235568392-19705-4-git-send-email-git@drmicha.warpmail.net","subject":"[PATCHv2 4/4] git submodule: Fix handling of // and /.. in paths for added submodules","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-02-25T13:26:32Z","receivedAt":"2009-02-25T13:26:32Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"This hopefully brings \"git submodule add\"'s parsing of paths in line\nwith \"git submodule init\"'s (which uses \"git ls-files\"), at least for\npractical purposes.\n\nIt fixes 2 known breakages which are marked \"success\" now.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n git-submodule.sh           |    6 ++++++\n t/t7400-submodule-basic.sh |    4 ++--\n 2 files changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 4f26be4..375362e 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -167,6 +167,12 @@ cmd_add()\n \t;;\n \tesac\n \n+\t# simplify multiple /\n+\tpath=$(echo \"$path\" | sed -e 's|/\\+|/|g')\n+\n+\t# resolve /.. (add trailing / for matching /..$)\n+\tpath=$(echo \"$path/\" | sed -e 's|\\([^/]*\\)/../||g')\n+\n \t# strip superfluous ./ from path\n \tpath=$(echo \"$path\" | sed -e 's|^\\(\\./\\)*||' -e's|/\\./|/|g')\n \ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex 21bdfeb..473d0e8 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -64,12 +64,12 @@ test_expect_success 'submodule add with ./ in path' '\n \tgit submodule init\n '\n \n-test_expect_failure 'submodule add with // in path' '\n+test_expect_success 'submodule add with // in path' '\n \tgit submodule add \"$submodurl\" slashslashsubmod///frotz// &&\n \tgit submodule init\n '\n \n-test_expect_failure 'submodule add with /.. in path' '\n+test_expect_success 'submodule add with /.. in path' '\n \tgit submodule add \"$submodurl\" dotdotsubmod/../realsubmod/frotz/.. &&\n \tgit submodule init\n '\n-- \n1.6.2.rc1.30.gd43c\n"},{"id":"106222","messageId":"49A55056.8020504@viscovery.net","threadId":"18002","inReplyTo":"1235568392-19705-5-git-send-email-git@drmicha.warpmail.net","subject":"Re: [PATCHv2 4/4] git submodule: Fix handling of // and /.. in paths for added submodules","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-02-25T14:06:14Z","receivedAt":"2009-02-25T14:06:14Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Michael J Gruber schrieb:\n> @@ -167,6 +167,12 @@ cmd_add()\n>  \t;;\n>  \tesac\n>  \n> +\t# simplify multiple /\n> +\tpath=$(echo \"$path\" | sed -e 's|/\\+|/|g')\n\nI think we have so far avoided \\+ in sed expressions for portability reasons.\n\n> +\n> +\t# resolve /.. (add trailing / for matching /..$)\n> +\tpath=$(echo \"$path/\" | sed -e 's|\\([^/]*\\)/../||g')\n\nThis does not work if there are more than two ../ in a row:\n\n\t$ echo a/b/c/../../d | sed -e 's|\\([^/]*\\)/\\.\\./||g'\n\ta/b/../d\n\n(and make this /\\.\\./ instead of /../).\n\n> +\n>  \t# strip superfluous ./ from path\n>  \tpath=$(echo \"$path\" | sed -e 's|^\\(\\./\\)*||' -e's|/\\./|/|g')\n\nThe latter two transformations should be swapped; otherwise you would\ntransform foo/./../bar into foo/bar.\n\nPerhaps it's now time to write this as:\n\n\t# normalize path\n\tpath=$(printf '%s\\n' \"$path\" |\n\t\t sed -e '\n\t\t\t# simplify multiple /\n\t\t\ts|//*|/|g\n\t\t\t# strip superfluous ./\n\t\t\ts|^\\(\\./\\)*||\n\t\t\ts|/\\./|/|g\n\t\t\t# resolve /..\n\t\t\ts|\\([^/]*\\)/\\.\\./||g\n\t\t\t# strip trailing slashes\n\t\t\ts|/*$||\n\t\t')\n\nBut unless you know how to solve the ../../ case with a sed program, I\nsuggest that you keep things simple and take care only of the common cases.\n\n-- Hannes\n"},{"id":"106223","messageId":"49A556D5.7020806@drmicha.warpmail.net","threadId":"18002","inReplyTo":"49A55056.8020504@viscovery.net","subject":"Re: [PATCHv2 4/4] git submodule: Fix handling of // and /.. in paths for added submodules","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-02-25T14:33:57Z","receivedAt":"2009-02-25T14:33:57Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Johannes Sixt venit, vidit, dixit 25.02.2009 15:06:\n> Michael J Gruber schrieb:\n>> @@ -167,6 +167,12 @@ cmd_add()\n>>  \t;;\n>>  \tesac\n>>  \n>> +\t# simplify multiple /\n>> +\tpath=$(echo \"$path\" | sed -e 's|/\\+|/|g')\n> \n> I think we have so far avoided \\+ in sed expressions for portability reasons.\n\nHmmpf. Is it that new, or gnu specific? I'm always afraid of portability\nissues with bash but wasn't aware of sed being an issue as well.\n\nIn any case, would 's|\\\\*|/|g' be better (more portable) then?\n\n>> +\n>> +\t# resolve /.. (add trailing / for matching /..$)\n>> +\tpath=$(echo \"$path/\" | sed -e 's|\\([^/]*\\)/../||g')\n> \n> This does not work if there are more than two ../ in a row:\n> \n> \t$ echo a/b/c/../../d | sed -e 's|\\([^/]*\\)/\\.\\./||g'\n> \ta/b/../d\n\nNow you got me ;)\nIt seems I misunderstood the meaning of 'g'. It's really multiple\nmatches in one step, not recursively matching multiple times.\n\n> (and make this /\\.\\./ instead of /../).\n\nOh yes, you're right, my oversight. Thanks!\n\nI guess this is why test writing and coding should not be done by the\nsame person...\n\n>> +\n>>  \t# strip superfluous ./ from path\n>>  \tpath=$(echo \"$path\" | sed -e 's|^\\(\\./\\)*||' -e's|/\\./|/|g')\n> \n> The latter two transformations should be swapped; otherwise you would\n> transform foo/./../bar into foo/bar.\n\nYes! I just checked, and git ls-files get's this right, so g-sm-add\nshould as well.\n\n> Perhaps it's now time to write this as:\n> \n> \t# normalize path\n> \tpath=$(printf '%s\\n' \"$path\" |\n> \t\t sed -e '\n> \t\t\t# simplify multiple /\n> \t\t\ts|//*|/|g\n> \t\t\t# strip superfluous ./\n> \t\t\ts|^\\(\\./\\)*||\n> \t\t\ts|/\\./|/|g\n> \t\t\t# resolve /..\n> \t\t\ts|\\([^/]*\\)/\\.\\./||g\n> \t\t\t# strip trailing slashes\n> \t\t\ts|/*$||\n> \t\t')\n> \n> But unless you know how to solve the ../../ case with a sed program, I\n> suggest that you keep things simple and take care only of the common cases.\n> \n> -- Hannes\n\nWell, how is\n\necho a/b/c/../../d | sed -e ':start;s|\\([^/]*\\)/\\.\\./||g;tstart'\na/d\n\nI meant: how portable is...\n\nCheers,\nMichael\n"},{"id":"106224","messageId":"49A55DAD.2000309@viscovery.net","threadId":"18002","inReplyTo":"49A556D5.7020806@drmicha.warpmail.net","subject":"Re: [PATCHv2 4/4] git submodule: Fix handling of // and /.. in paths for added submodules","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-02-25T15:03:09Z","receivedAt":"2009-02-25T15:03:09Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Michael J Gruber schrieb:\n> Johannes Sixt venit, vidit, dixit 25.02.2009 15:06:\n>> I think we have so far avoided \\+ in sed expressions for portability reasons.\n> \n> Hmmpf. Is it that new, or gnu specific? I'm always afraid of portability\n> issues with bash but wasn't aware of sed being an issue as well.\n> \n> In any case, would 's|\\\\*|/|g' be better (more portable) then?\n\nYou mean 's|//*|/|g'; yes, that is definitly portable.\n\n> Well, how is\n> \n> echo a/b/c/../../d | sed -e ':start;s|\\([^/]*\\)/\\.\\./||g;tstart'\n> a/d\n> \n> I meant: how portable is...\n\nI don't know... Let's see: My AIX 4.3.3 sed understands it if it is not\nall on a single line, and that says a lot. Specifically, I tried this:\n\necho a/b/c/../../d | sed -e ':start\n             s|\\([^/]*\\)/\\.\\./||\n             tstart\n'\n\nand got the desired result:\n\na/d\n\nNote that the 'g' flag is not necessary in this case.\n\nOTOH, this sed doesn't understand #comments :-/\n\n-- Hannes\n"},{"id":"106259","messageId":"7vd4d61a6u.fsf@gitster.siamese.dyndns.org","threadId":"18002","inReplyTo":"1235559820-3096-2-git-send-email-git@drmicha.warpmail.net","subject":"Re: [PATCH 1/2] git submodule: Add test cases for git submodule add","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-25T21:24:57Z","receivedAt":"2009-02-25T21:24:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\n> index b8cb2df..b154050 100755\n> --- a/t/t7400-submodule-basic.sh\n> +++ b/t/t7400-submodule-basic.sh\n> @@ -47,6 +47,25 @@ test_expect_success 'Prepare submodule testing' '\n>  \tGIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/init.git\n>  '\n\nPlease don't chdir around in individual tests.  Instead have each test\nbegin and end in the original directory given.  Like:\n\n> +test_expect_success 'Prepare submodule add testing' '\n> +\tsubmodurl=$(pwd)\n> +\tmkdir addtest &&\n> +\tpushd addtest &&\n> +\tgit init\n> +'\n\n\t(\n        \tmkdir addtest &&\n                cd addtest &&\n                git init\n\t)\n\n> +test_expect_success 'submodule add' '\n> +\tgit submodule add \"$submodurl\" submod &&\n> +\tgit submodule init\n> +'\n\n\t(\n        \tcd addtest &&\n                git submodule add ...\n\t)                \n\n> +test_expect_failure 'submodule add with ./ in path' '\n> +\tgit submodule add \"$submodurl\" ././dotsubmod/./frotz/./ &&\n> +\tgit submodule init\n> +'\n> +# end of submodule add testing\n> +popd >/dev/null\n\nThe rule of thumb is minimize things done outside of tests, like this\npopd.\n\nThis is to prevent mistaken test sequence to go up too many levels.  E.g.\nan earlier test that is supposed to chdir down and make the subsequent\ntests begin at one level deeper than the original could fail, but when\ntests are run without the \"-i\" option, the failed test would not abort the\nwhole sequence.  The subsequent tests run in a wrong place, and one of\nthem would try to chdir up to come back to the original directory, but\ntheir \"cd ..\" will go up too high, because the first chdir that tried to\ngo down failed.\n"},{"id":"106261","messageId":"7v7i3e1a6i.fsf@gitster.siamese.dyndns.org","threadId":"18002","inReplyTo":"49A541D3.4030001@viscovery.net","subject":"Re: [PATCH 2/2] git submodule: Fix adding of submodules at paths with ./","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-25T21:25:09Z","receivedAt":"2009-02-25T21:25:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> Michael J Gruber schrieb:\n> ...\n>> Now, the /// are in fact a valid concern[1], although probably not that\n>> common an isue.\n>\n> I'm fine if only common use cases are taken care of. If you say that ./ is\n> common and /// is not, then I'll believe it because I'm not a git\n> submodule user (yet) and can't argue about this with my own experience.\n\nEven if it is not worth the complication to the code to fix /// or /../\ncases, I think it is worth *detecting* such an incoming path and error\nout, telling the user not to give a \"funky\" path.\n"},{"id":"106260","messageId":"7v1vtm1a6b.fsf@gitster.siamese.dyndns.org","threadId":"18002","inReplyTo":"49A55DAD.2000309@viscovery.net","subject":"Re: [PATCHv2 4/4] git submodule: Fix handling of // and /.. in paths for added submodules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-25T21:25:16Z","receivedAt":"2009-02-25T21:25:16Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> Michael J Gruber schrieb:\n>> Johannes Sixt venit, vidit, dixit 25.02.2009 15:06:\n>>> I think we have so far avoided \\+ in sed expressions for portability reasons.\n>> \n>> Hmmpf. Is it that new, or gnu specific? I'm always afraid of portability\n>> issues with bash but wasn't aware of sed being an issue as well.\n>> \n>> In any case, would 's|\\\\*|/|g' be better (more portable) then?\n>\n> You mean 's|//*|/|g'; yes, that is definitly portable.\n>\n>> Well, how is\n>> \n>> echo a/b/c/../../d | sed -e ':start;s|\\([^/]*\\)/\\.\\./||g;tstart'\n>> a/d\n>> \n>> I meant: how portable is...\n>\n> I don't know... Let's see: My AIX 4.3.3 sed understands it if it is not\n> all on a single line, and that says a lot. Specifically, I tried this:\n>\n> echo a/b/c/../../d | sed -e ':start\n>              s|\\([^/]*\\)/\\.\\./||\n>              tstart\n> '\n>\n> and got the desired result:\n>\n> a/d\n>\n> Note that the 'g' flag is not necessary in this case.\n>\n> OTOH, this sed doesn't understand #comments :-/\n\nHistorically, sed was much worse than the shell when it came to the\nportability issues, especially before people started to use bash, which\ntipped the balance a bit by worsening the situation for the shell side.\n\nThe sed scripts in the more important parts of scripted Porcelains avoid\nmultiple commands on a single line concatenated with \";\" mostly by inertia\non my side, but it was acquired exactly from this kind of portability\nmess.  IIRC, AIX's was the worst offender. It also got \"/A/../B/ { ... }\"\nwrong in earlier versions.\n"},{"id":"106304","messageId":"49A65B4C.305@drmicha.warpmail.net","threadId":"18002","inReplyTo":"7v1vtm1a6b.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCHv2 4/4] git submodule: Fix handling of // and /.. in paths for added submodules","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-02-26T09:05:16Z","receivedAt":"2009-02-26T09:05:16Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano venit, vidit, dixit 25.02.2009 22:25:\n> Johannes Sixt <j.sixt@viscovery.net> writes:\n> \n>> Michael J Gruber schrieb:\n>>> Johannes Sixt venit, vidit, dixit 25.02.2009 15:06:\n>>>> I think we have so far avoided \\+ in sed expressions for portability reasons.\n>>> Hmmpf. Is it that new, or gnu specific? I'm always afraid of portability\n>>> issues with bash but wasn't aware of sed being an issue as well.\n>>>\n>>> In any case, would 's|\\\\*|/|g' be better (more portable) then?\n>> You mean 's|//*|/|g'; yes, that is definitly portable.\n>>\n>>> Well, how is\n>>>\n>>> echo a/b/c/../../d | sed -e ':start;s|\\([^/]*\\)/\\.\\./||g;tstart'\n>>> a/d\n>>>\n>>> I meant: how portable is...\n>> I don't know... Let's see: My AIX 4.3.3 sed understands it if it is not\n>> all on a single line, and that says a lot. Specifically, I tried this:\n>>\n>> echo a/b/c/../../d | sed -e ':start\n>>              s|\\([^/]*\\)/\\.\\./||\n>>              tstart\n>> '\n>>\n>> and got the desired result:\n>>\n>> a/d\n>>\n>> Note that the 'g' flag is not necessary in this case.\n>>\n>> OTOH, this sed doesn't understand #comments :-/\n> \n> Historically, sed was much worse than the shell when it came to the\n> portability issues, especially before people started to use bash, which\n> tipped the balance a bit by worsening the situation for the shell side.\n> \n> The sed scripts in the more important parts of scripted Porcelains avoid\n> multiple commands on a single line concatenated with \";\" mostly by inertia\n> on my side, but it was acquired exactly from this kind of portability\n> mess.  IIRC, AIX's was the worst offender. It also got \"/A/../B/ { ... }\"\n> wrong in earlier versions.\n\nI'm a bit confused now. Are you saying that \"git-submodule.sh\" should\navoid the multiple lines in sed (which work in AIX 4.3.3)? I don't know\nhow to simplify a/b/c/../../ easily then. Of course one could loop\naround in shell rather than using sed's \"goto\", but that looks ugly.\n\nI think that's my only question before doing a v3 which will be a good\n\"cd citizen\" in tests and test for more idiosyncracies.\n\nOh wait: Would it be worthwhile to have that shell version of\nnormalize_path_copy() in git-sh-setup instead?\n\nMichael\n"},{"id":"106342","messageId":"7vtz6ht9ho.fsf@gitster.siamese.dyndns.org","threadId":"18002","inReplyTo":"49A65B4C.305@drmicha.warpmail.net","subject":"Re: [PATCHv2 4/4] git submodule: Fix handling of // and /.. in paths for added submodules","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-26T17:04:51Z","receivedAt":"2009-02-26T17:04:51Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> Junio C Hamano venit, vidit, dixit 25.02.2009 22:25:\n>\n>> The sed scripts in the more important parts of scripted Porcelains avoid\n>> multiple commands on a single line concatenated with \";\" mostly by inertia\n>> on my side, but it was acquired exactly from this kind of portability\n>> mess.  IIRC, AIX's was the worst offender. It also got \"/A/../B/ { ... }\"\n>> wrong in earlier versions.\n>\n> I'm a bit confused now. Are you saying that \"git-submodule.sh\" should\n> avoid the multiple lines in sed (which work in AIX 4.3.3)?\n\nNo, I understand J6t's comment:\n\n>>> I don't know... Let's see: My AIX 4.3.3 sed understands it if it is not\n>>> all on a single line, and that says a lot. Specifically, I tried this:\n\nto mean that this is bad:\n\n\tsed -e 'a;b;c;d;e'\n\nwhile this works\n\n\tsed -e '\n        \ta\n                b\n                c\n                d\n                e\n\t'\n"},{"id":"106829","messageId":"1236083989-20526-1-git-send-email-git@drmicha.warpmail.net","threadId":"18002","inReplyTo":"7vtz6ht9ho.fsf@gitster.siamese.dyndns.org","subject":"[PATCHv3 0/2] git submodule: normalize paths before adding","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-03-03T12:39:47Z","receivedAt":"2009-03-03T12:39:47Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"This is a rewrite taking into account the advice given by Junio and J6t.\nIn particular, the tests are good citizens w.r.t. cd'ing around now, the\nsed expressions work at least on AIX 4.3.3, and iterations of .. are\ntested for and handled correctly.\n\nSorry I didn't get around to finishing this earlier. Hope this doesn't\nmess up any schedules.\n\nMichael J Gruber (2):\n  git submodule: Add test cases for git submodule add\n  git submodule: Fix adding of submodules at paths with ./, .. and //\n\n git-submodule.sh           |   15 ++++++++++--\n t/t7400-submodule-basic.sh |   49 ++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 61 insertions(+), 3 deletions(-)\n"},{"id":"106828","messageId":"1236083989-20526-2-git-send-email-git@drmicha.warpmail.net","threadId":"18002","inReplyTo":"1236083989-20526-1-git-send-email-git@drmicha.warpmail.net","subject":"[PATCHv3 1/2] git submodule: Add test cases for git submodule add","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-03-03T12:39:48Z","receivedAt":"2009-03-03T12:39:48Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Add simple test cases for adding and initialising submodules. The\ninit step is necessary in order to verify the added information.\n\nThe second test exposes a known breakage due to './' in the path: git\nls-files simplifies the path but git add does not, which leads to git\ninit looking for different lines in .gitmodules than git add adds.\n\nThe other tests add test cases for '//' and '..' in the path which\ncurrently fail for the same reason.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\nThe init step test implicitly whether add and init treat the path in the\nsame way.\n\n t/t7400-submodule-basic.sh |   49 ++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 49 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex b8cb2df..4f42585 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -47,6 +47,55 @@ test_expect_success 'Prepare submodule testing' '\n \tGIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/init.git\n '\n \n+test_expect_success 'Prepare submodule add testing' '\n+\tsubmodurl=$(pwd)\n+\t(\n+\t\tmkdir addtest &&\n+\t\tcd addtest &&\n+\t\tgit init\n+\t)\n+'\n+\n+test_expect_success 'submodule add' '\n+\t(\n+\t\tcd addtest &&\n+\t\tgit submodule add \"$submodurl\" submod &&\n+\t\tgit submodule init\n+\t)\n+'\n+\n+test_expect_failure 'submodule add with ./ in path' '\n+\t(\n+\t\tcd addtest &&\n+\t\tgit submodule add \"$submodurl\" ././dotsubmod/./frotz/./ &&\n+\t\tgit submodule init\n+\t)\n+'\n+\n+test_expect_failure 'submodule add with // in path' '\n+\t(\n+\t\tcd addtest &&\n+\t\tgit submodule add \"$submodurl\" slashslashsubmod///frotz// &&\n+\t\tgit submodule init\n+\t)\n+'\n+\n+test_expect_failure 'submodule add with /.. in path' '\n+\t(\n+\t\tcd addtest &&\n+\t\tgit submodule add \"$submodurl\" dotdotsubmod/../realsubmod/frotz/.. &&\n+\t\tgit submodule init\n+\t)\n+'\n+\n+test_expect_failure 'submodule add with ./, /.. and // in path' '\n+\t(\n+\t\tcd addtest &&\n+\t\tgit submodule add \"$submodurl\" dot/dotslashsubmod/./../..////realsubmod2/frotz//.. &&\n+\t\tgit submodule init\n+\t)\n+'\n+\n test_expect_success 'status should fail for unmapped paths' '\n \tif git submodule status\n \tthen\n-- \n1.6.2.rc2\n"},{"id":"106830","messageId":"1236083989-20526-3-git-send-email-git@drmicha.warpmail.net","threadId":"18002","inReplyTo":"1236083989-20526-2-git-send-email-git@drmicha.warpmail.net","subject":"[PATCHv3 2/2] git submodule: Fix adding of submodules at paths with ./, .. and //","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-03-03T12:39:49Z","receivedAt":"2009-03-03T12:39:49Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Make 'git submodule add' normalize the submodule path in the\nsame way as 'git ls-files' does, so that 'git submodule init' looks up\nthe information in .gitmodules with the same key under which 'git\nsubmodule add' stores it.\n\nThis fixes 4 known breakages.\n---\nNote that sed on AIX does not like comments, which is why they are not\nin the sed expression.\n\n git-submodule.sh           |   15 ++++++++++++---\n t/t7400-submodule-basic.sh |    8 ++++----\n 2 files changed, 16 insertions(+), 7 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 204aab6..7a25f47 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -167,9 +167,18 @@ cmd_add()\n \t;;\n \tesac\n \n-\t# strip trailing slashes from path\n-\tpath=$(echo \"$path\" | sed -e 's|/*$||')\n-\n+\t# normalize path:\n+\t# multiple //; leading ./; /./; /../; trailing /\n+\tpath=$(printf '%s/\\n' \"$path\" |\n+\t\tsed -e '\n+\t\t\ts|//*|/|g\n+\t\t\ts|^\\(\\./\\)*||\n+\t\t\ts|/\\./|/|g\n+\t\t\t:start\n+\t\t\ts|\\([^/]*\\)/\\.\\./||g\n+\t\t\ttstart\n+\t\t\ts|/*$||\n+\t\t')\n \tgit ls-files --error-unmatch \"$path\" > /dev/null 2>&1 &&\n \tdie \"'$path' already exists in the index\"\n \ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex 4f42585..1c82f8c 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -64,7 +64,7 @@ test_expect_success 'submodule add' '\n \t)\n '\n \n-test_expect_failure 'submodule add with ./ in path' '\n+test_expect_success 'submodule add with ./ in path' '\n \t(\n \t\tcd addtest &&\n \t\tgit submodule add \"$submodurl\" ././dotsubmod/./frotz/./ &&\n@@ -72,7 +72,7 @@ test_expect_failure 'submodule add with ./ in path' '\n \t)\n '\n \n-test_expect_failure 'submodule add with // in path' '\n+test_expect_success 'submodule add with // in path' '\n \t(\n \t\tcd addtest &&\n \t\tgit submodule add \"$submodurl\" slashslashsubmod///frotz// &&\n@@ -80,7 +80,7 @@ test_expect_failure 'submodule add with // in path' '\n \t)\n '\n \n-test_expect_failure 'submodule add with /.. in path' '\n+test_expect_success 'submodule add with /.. in path' '\n \t(\n \t\tcd addtest &&\n \t\tgit submodule add \"$submodurl\" dotdotsubmod/../realsubmod/frotz/.. &&\n@@ -88,7 +88,7 @@ test_expect_failure 'submodule add with /.. in path' '\n \t)\n '\n \n-test_expect_failure 'submodule add with ./, /.. and // in path' '\n+test_expect_success 'submodule add with ./, /.. and // in path' '\n \t(\n \t\tcd addtest &&\n \t\tgit submodule add \"$submodurl\" dot/dotslashsubmod/./../..////realsubmod2/frotz//.. &&\n-- \n1.6.2.rc2\n"},{"id":"106834","messageId":"49AD2BE6.1000105@viscovery.net","threadId":"18002","inReplyTo":"1236083989-20526-3-git-send-email-git@drmicha.warpmail.net","subject":"Re: [PATCHv3 2/2] git submodule: Fix adding of submodules at paths with ./, .. and //","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-03-03T13:08:54Z","receivedAt":"2009-03-03T13:08:54Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Michael J Gruber schrieb:\n> +\t# normalize path:\n> +\t# multiple //; leading ./; /./; /../; trailing /\n> +\tpath=$(printf '%s/\\n' \"$path\" |\n> +\t\tsed -e '\n> +\t\t\ts|//*|/|g\n> +\t\t\ts|^\\(\\./\\)*||\n> +\t\t\ts|/\\./|/|g\n> +\t\t\t:start\n> +\t\t\ts|\\([^/]*\\)/\\.\\./||g\n\nSorry to say: not yet. This turns \"a/b/c/d/../../../d\" into \"a/b/c/d\"\ninstead of \"a/d\". Drop the 'g'.\n\nOnce this is fixed, I have to ask what should happen with path names like\n\"../a/b\", \"../../a/b\"? Should there be a warning or error?\n\nOther than that, this expression works on AIX 4.3.3! Note in particular\nthat '\\n' in the printf format string is essential!\n\n> +\t\t\ttstart\n> +\t\t\ts|/*$||\n> +\t\t')\n\n-- Hannes\n"},{"id":"106838","messageId":"49AD3A29.10404@drmicha.warpmail.net","threadId":"18002","inReplyTo":"49AD2BE6.1000105@viscovery.net","subject":"Re: [PATCHv3 2/2] git submodule: Fix adding of submodules at paths with ./, .. and //","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-03-03T14:09:45Z","receivedAt":"2009-03-03T14:09:45Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Johannes Sixt venit, vidit, dixit 03.03.2009 14:08:\n> Michael J Gruber schrieb:\n>> +\t# normalize path:\n>> +\t# multiple //; leading ./; /./; /../; trailing /\n>> +\tpath=$(printf '%s/\\n' \"$path\" |\n>> +\t\tsed -e '\n>> +\t\t\ts|//*|/|g\n>> +\t\t\ts|^\\(\\./\\)*||\n>> +\t\t\ts|/\\./|/|g\n>> +\t\t\t:start\n>> +\t\t\ts|\\([^/]*\\)/\\.\\./||g\n> \n> Sorry to say: not yet. This turns \"a/b/c/d/../../../d\" into \"a/b/c/d\"\n> instead of \"a/d\". Drop the 'g'.\n\nShoot, I thought I had a complete test case...\nThanks for spotting.\n\n> Once this is fixed, I have to ask what should happen with path names like\n> \"../a/b\", \"../../a/b\"? Should there be a warning or error?\n\nThat triggers the error message when trying to git add a submodule which\nis not within the current wc. Same before and after the patch, and I\nthink that's how it should be.\n\n> Other than that, this expression works on AIX 4.3.3! Note in particular\n> that '\\n' in the printf format string is essential!\n\nI learned that from you ;)\n\nMichael\n\n> \n>> +\t\t\ttstart\n>> +\t\t\ts|/*$||\n>> +\t\t')\n> \n> -- Hannes\n> \n"},{"id":"106839","messageId":"alpine.DEB.1.00.0903031529040.6399@intel-tinevez-2-302","threadId":"18002","inReplyTo":"1236083989-20526-3-git-send-email-git@drmicha.warpmail.net","subject":"Re: [PATCHv3 2/2] git submodule: Fix adding of submodules at paths with ./, .. and //","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-03-03T14:29:29Z","receivedAt":"2009-03-03T14:29:29Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 3 Mar 2009, Michael J Gruber wrote:\n\n> Make 'git submodule add' normalize the submodule path in the\n> same way as 'git ls-files' does, so that 'git submodule init' looks up\n> the information in .gitmodules with the same key under which 'git\n> submodule add' stores it.\n> \n> This fixes 4 known breakages.\n\nMaybe it is time to turn this into a builtin?\n\nCiao,\nDscho\n"},{"id":"106842","messageId":"49AD45A7.10906@drmicha.warpmail.net","threadId":"18002","inReplyTo":"alpine.DEB.1.00.0903031529040.6399@intel-tinevez-2-302","subject":"Re: [PATCHv3 2/2] git submodule: Fix adding of submodules at paths with ./, .. and //","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-03-03T14:58:47Z","receivedAt":"2009-03-03T14:58:47Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Johannes Schindelin venit, vidit, dixit 03.03.2009 15:29:\n> Hi,\n> \n> On Tue, 3 Mar 2009, Michael J Gruber wrote:\n> \n>> Make 'git submodule add' normalize the submodule path in the\n>> same way as 'git ls-files' does, so that 'git submodule init' looks up\n>> the information in .gitmodules with the same key under which 'git\n>> submodule add' stores it.\n>>\n>> This fixes 4 known breakages.\n> \n> Maybe it is time to turn this into a builtin?\n\nUhm, you mean all of submodule or just the normalize part? Isn't git\nsubmodule up for some rewriting (.gitmodule...) anyways?\n\nI suggest applying the tests and fix before Bob the In-Builder rolls in.\nAnd no, Bob's not my alter ego...\n\nMichael\n"},{"id":"106843","messageId":"1236092901-28500-1-git-send-email-git@drmicha.warpmail.net","threadId":"18002","inReplyTo":"49AD3A29.10404@drmicha.warpmail.net","subject":"[PATCHv4 0/2] git submodule: normalize paths before adding","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-03-03T15:08:19Z","receivedAt":"2009-03-03T15:08:19Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"This is a rewrite taking into account the advice given by Junio and J6t.\nIn particular, the tests are good citizens w.r.t. cd'ing around now, the\nsed expressions work at least on AIX 4.3.3, and iterations of .. are\ntested for and handled correctly.\n\nSorry I didn't get around to finishing this earlier. Hope this doesn't\nmess up any schedules.\n\nv4 incorporates a fix by J6t regarding a spurious g specifier in the sed expression for \"..\".\n\nMichael J Gruber (2):\n  git submodule: Add test cases for git submodule add\n  git submodule: Fix adding of submodules at paths with ./, .. and //\n\n git-submodule.sh           |   15 ++++++++++--\n t/t7400-submodule-basic.sh |   49 ++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 61 insertions(+), 3 deletions(-)\n"},{"id":"106844","messageId":"1236092901-28500-2-git-send-email-git@drmicha.warpmail.net","threadId":"18002","inReplyTo":"1236092901-28500-1-git-send-email-git@drmicha.warpmail.net","subject":"[PATCHv4 1/2] git submodule: Add test cases for git submodule add","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-03-03T15:08:20Z","receivedAt":"2009-03-03T15:08:20Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Add simple test cases for adding and initialising submodules. The\ninit step is necessary in order to verify the added information.\n\nThe second test exposes a known breakage due to './' in the path: git\nls-files simplifies the path but git add does not, which leads to git\ninit looking for different lines in .gitmodules than git add adds.\n\nThe other tests add test cases for '//' and '..' in the path which\ncurrently fail for the same reason.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n t/t7400-submodule-basic.sh |   49 ++++++++++++++++++++++++++++++++++++++++++++\n 1 files changed, 49 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex b8cb2df..35a0ede 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -47,6 +47,55 @@ test_expect_success 'Prepare submodule testing' '\n \tGIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/init.git\n '\n \n+test_expect_success 'Prepare submodule add testing' '\n+\tsubmodurl=$(pwd)\n+\t(\n+\t\tmkdir addtest &&\n+\t\tcd addtest &&\n+\t\tgit init\n+\t)\n+'\n+\n+test_expect_success 'submodule add' '\n+\t(\n+\t\tcd addtest &&\n+\t\tgit submodule add \"$submodurl\" submod &&\n+\t\tgit submodule init\n+\t)\n+'\n+\n+test_expect_failure 'submodule add with ./ in path' '\n+\t(\n+\t\tcd addtest &&\n+\t\tgit submodule add \"$submodurl\" ././dotsubmod/./frotz/./ &&\n+\t\tgit submodule init\n+\t)\n+'\n+\n+test_expect_failure 'submodule add with // in path' '\n+\t(\n+\t\tcd addtest &&\n+\t\tgit submodule add \"$submodurl\" slashslashsubmod///frotz// &&\n+\t\tgit submodule init\n+\t)\n+'\n+\n+test_expect_failure 'submodule add with /.. in path' '\n+\t(\n+\t\tcd addtest &&\n+\t\tgit submodule add \"$submodurl\" dotdotsubmod/../realsubmod/frotz/.. &&\n+\t\tgit submodule init\n+\t)\n+'\n+\n+test_expect_failure 'submodule add with ./, /.. and // in path' '\n+\t(\n+\t\tcd addtest &&\n+\t\tgit submodule add \"$submodurl\" dot/dotslashsubmod/./../..////realsubmod2/a/b/c/d/../../../../frotz//.. &&\n+\t\tgit submodule init\n+\t)\n+'\n+\n test_expect_success 'status should fail for unmapped paths' '\n \tif git submodule status\n \tthen\n-- \n1.6.2.rc2\n"},{"id":"106845","messageId":"1236092901-28500-3-git-send-email-git@drmicha.warpmail.net","threadId":"18002","inReplyTo":"1236092901-28500-2-git-send-email-git@drmicha.warpmail.net","subject":"[PATCHv4 2/2] git submodule: Fix adding of submodules at paths with ./, .. and //","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-03-03T15:08:21Z","receivedAt":"2009-03-03T15:08:21Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Make 'git submodule add' normalize the submodule path in the\nsame way as 'git ls-files' does, so that 'git submodule init' looks up\nthe information in .gitmodules with the same key under which 'git\nsubmodule add' stores it.\n\nThis fixes 4 known breakages.\n---\n git-submodule.sh           |   15 ++++++++++++---\n t/t7400-submodule-basic.sh |    8 ++++----\n 2 files changed, 16 insertions(+), 7 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 204aab6..0a27232 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -167,9 +167,18 @@ cmd_add()\n \t;;\n \tesac\n \n-\t# strip trailing slashes from path\n-\tpath=$(echo \"$path\" | sed -e 's|/*$||')\n-\n+\t# normalize path:\n+\t# multiple //; leading ./; /./; /../; trailing /\n+\tpath=$(printf '%s/\\n' \"$path\" |\n+\t\tsed -e '\n+\t\t\ts|//*|/|g\n+\t\t\ts|^\\(\\./\\)*||\n+\t\t\ts|/\\./|/|g\n+\t\t\t:start\n+\t\t\ts|\\([^/]*\\)/\\.\\./||\n+\t\t\ttstart\n+\t\t\ts|/*$||\n+\t\t')\n \tgit ls-files --error-unmatch \"$path\" > /dev/null 2>&1 &&\n \tdie \"'$path' already exists in the index\"\n \ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex 35a0ede..af690ec 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -64,7 +64,7 @@ test_expect_success 'submodule add' '\n \t)\n '\n \n-test_expect_failure 'submodule add with ./ in path' '\n+test_expect_success 'submodule add with ./ in path' '\n \t(\n \t\tcd addtest &&\n \t\tgit submodule add \"$submodurl\" ././dotsubmod/./frotz/./ &&\n@@ -72,7 +72,7 @@ test_expect_failure 'submodule add with ./ in path' '\n \t)\n '\n \n-test_expect_failure 'submodule add with // in path' '\n+test_expect_success 'submodule add with // in path' '\n \t(\n \t\tcd addtest &&\n \t\tgit submodule add \"$submodurl\" slashslashsubmod///frotz// &&\n@@ -80,7 +80,7 @@ test_expect_failure 'submodule add with // in path' '\n \t)\n '\n \n-test_expect_failure 'submodule add with /.. in path' '\n+test_expect_success 'submodule add with /.. in path' '\n \t(\n \t\tcd addtest &&\n \t\tgit submodule add \"$submodurl\" dotdotsubmod/../realsubmod/frotz/.. &&\n@@ -88,7 +88,7 @@ test_expect_failure 'submodule add with /.. in path' '\n \t)\n '\n \n-test_expect_failure 'submodule add with ./, /.. and // in path' '\n+test_expect_success 'submodule add with ./, /.. and // in path' '\n \t(\n \t\tcd addtest &&\n \t\tgit submodule add \"$submodurl\" dot/dotslashsubmod/./../..////realsubmod2/a/b/c/d/../../../../frotz//.. &&\n-- \n1.6.2.rc2\n"},{"id":"106848","messageId":"49AD4C97.6010806@viscovery.net","threadId":"18002","inReplyTo":"1236092901-28500-3-git-send-email-git@drmicha.warpmail.net","subject":"Re: [PATCHv4 2/2] git submodule: Fix adding of submodules at paths with ./, .. and //","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-03-03T15:28:23Z","receivedAt":"2009-03-03T15:28:23Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Michael J Gruber schrieb:\n> Make 'git submodule add' normalize the submodule path in the\n> same way as 'git ls-files' does, so that 'git submodule init' looks up\n> the information in .gitmodules with the same key under which 'git\n> submodule add' stores it.\n> \n> This fixes 4 known breakages.\n> ---\n\nOK!\n\nTested-by: Johannes Sixt <j6t@kdbg.org> (AIX)\n\nbut really, I ran only: cd t && make *submodule*\n\nYou certainly will sign off this patch?\n\n-- Hannes\n"},{"id":"106851","messageId":"7v3aduehz2.fsf@gitster.siamese.dyndns.org","threadId":"18002","inReplyTo":"49AD2BE6.1000105@viscovery.net","subject":"Re: [PATCHv3 2/2] git submodule: Fix adding of submodules at paths with ./, .. and //","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-03T15:36:33Z","receivedAt":"2009-03-03T15:36:33Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> Michael J Gruber schrieb:\n>> +\t# normalize path:\n>> +\t# multiple //; leading ./; /./; /../; trailing /\n>> +\tpath=$(printf '%s/\\n' \"$path\" |\n>> +\t\tsed -e '\n>> +\t\t\ts|//*|/|g\n>> +\t\t\ts|^\\(\\./\\)*||\n>> +\t\t\ts|/\\./|/|g\n>> +\t\t\t:start\n>> +\t\t\ts|\\([^/]*\\)/\\.\\./||g\n>\n> Sorry to say: not yet. This turns \"a/b/c/d/../../../d\" into \"a/b/c/d\"\n> instead of \"a/d\". Drop the 'g'.\n>\n> Once this is fixed, I have to ask what should happen with path names like\n> \"../a/b\", \"../../a/b\"? Should there be a warning or error?\n>\n> Other than that, this expression works on AIX 4.3.3! Note in particular\n> that '\\n' in the printf format string is essential!\n>\n>> +\t\t\ttstart\n>> +\t\t\ts|/*$||\n>> +\t\t')\n\nAt some point you should wonder if all of this complication is worth it,\nor it makes sense to reject when you see // or /\\.\\./ in the input.\n"},{"id":"106852","messageId":"49AD4F1A.5080704@drmicha.warpmail.net","threadId":"18002","inReplyTo":"49AD4C97.6010806@viscovery.net","subject":"Re: [PATCHv4 2/2] git submodule: Fix adding of submodules at paths with ./, .. and //","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-03-03T15:39:06Z","receivedAt":"2009-03-03T15:39:06Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Johannes Sixt venit, vidit, dixit 03.03.2009 16:28:\n> Michael J Gruber schrieb:\n>> Make 'git submodule add' normalize the submodule path in the\n>> same way as 'git ls-files' does, so that 'git submodule init' looks up\n>> the information in .gitmodules with the same key under which 'git\n>> submodule add' stores it.\n>>\n>> This fixes 4 known breakages.\n>> ---\n> \n> OK!\n> \n> Tested-by: Johannes Sixt <j6t@kdbg.org> (AIX)\n> \n> but really, I ran only: cd t && make *submodule*\n> \n> You certainly will sign off this patch?\n> \n> -- Hannes\n\nGrrmmml. Yes, 2/2 is sob me just as 1/2 is. This comes from switching\nfrom \"git f-p -s\" to \"git ci -s\" recently and forgetting during\nrewrite... So please consider all of PATCHv4 to be\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n\nand\n\nSanity-added-by: Johannes Sixt <j.sixt@viscovery.net>\n\n<goes and does git config alias.ci 'commit -s'>\n\nMichael\n"},{"id":"106855","messageId":"49AD5159.8060605@drmicha.warpmail.net","threadId":"18002","inReplyTo":"7v3aduehz2.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCHv3 2/2] git submodule: Fix adding of submodules at paths with ./, .. and //","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-03-03T15:48:41Z","receivedAt":"2009-03-03T15:48:41Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano venit, vidit, dixit 03.03.2009 16:36:\n> Johannes Sixt <j.sixt@viscovery.net> writes:\n> \n>> Michael J Gruber schrieb:\n>>> +\t# normalize path:\n>>> +\t# multiple //; leading ./; /./; /../; trailing /\n>>> +\tpath=$(printf '%s/\\n' \"$path\" |\n>>> +\t\tsed -e '\n>>> +\t\t\ts|//*|/|g\n>>> +\t\t\ts|^\\(\\./\\)*||\n>>> +\t\t\ts|/\\./|/|g\n>>> +\t\t\t:start\n>>> +\t\t\ts|\\([^/]*\\)/\\.\\./||g\n>> Sorry to say: not yet. This turns \"a/b/c/d/../../../d\" into \"a/b/c/d\"\n>> instead of \"a/d\". Drop the 'g'.\n>>\n>> Once this is fixed, I have to ask what should happen with path names like\n>> \"../a/b\", \"../../a/b\"? Should there be a warning or error?\n>>\n>> Other than that, this expression works on AIX 4.3.3! Note in particular\n>> that '\\n' in the printf format string is essential!\n>>\n>>> +\t\t\ttstart\n>>> +\t\t\ts|/*$||\n>>> +\t\t')\n> \n> At some point you should wonder if all of this complication is worth it,\n> or it makes sense to reject when you see // or /\\.\\./ in the input.\n\nI surely do wonder now! This started off treating merely leading ./ as\nreported problematic by AT. Then the \"do it really right\" competition\nstarted, and I think J6t and I came out as clear winners. There were no\nother contenders.\n\nSeriously, \"git submodule init\" does that normalization (by using\nls-files), so I think it does make sense to have it for add as well. git\nsubmodule itself may have semi-porc/semi-plumb character, but if someone\nwants to add submodules programmatically there is no simple way around\nusing \"git submodule add\", and paths may very well be constructed\nrelatively.\n\nMichael\n"},{"id":"106876","messageId":"7vbpsid0u5.fsf@gitster.siamese.dyndns.org","threadId":"18002","inReplyTo":"1236092901-28500-1-git-send-email-git@drmicha.warpmail.net","subject":"Re: [PATCHv4 0/2] git submodule: normalize paths before adding","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-03-03T16:32:02Z","receivedAt":"2009-03-03T16:32:02Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> This is a rewrite taking into account the advice given by Junio and J6t.\n> In particular, the tests are good citizens w.r.t. cd'ing around now, the\n> sed expressions work at least on AIX 4.3.3, and iterations of .. are\n> tested for and handled correctly.\n>\n> Sorry I didn't get around to finishing this earlier. Hope this doesn't\n> mess up any schedules.\n\nNo worries.\n\nOther than obvious documentation fixes, anything sent after -rc0 will not\nhit 'master' unless it is a fix, and after -rc1 nothing will hit 'master'\nunless it is a regression fix.  Even if some future version of your patch\nis queued to 'pu' or 'next, it won't affect the schedule for 1.6.2.\n\nTraditionally, those patches that are irrelevant to the upcoming release\nduring the -rc period have been discussed on the list and then discarded,\nwith a request to be resubmit after the release.  Even though I have been\nqueuing them to 'pu' or 'next' as an experiment during this cycle, it has\nnot changed that during the -rc period, any new topic will not disrupt the\nupcoming release.\n"}]}