{"thread":{"id":"30277","subject":"Delete gitlink entry but keep .gitmodules file unmodified","startedAt":"2012-04-18T13:19:25Z","lastAt":"2012-04-19T09:10:58Z","messageCount":4,"participants":["Semen Vadishev","Jens Lehmann"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"189627","messageId":"4F8EBF5D.5070301@tmatesoft.com","threadId":"30277","inReplyTo":null,"subject":"Delete gitlink entry but keep .gitmodules file unmodified","fromName":"Semen Vadishev","fromEmail":"semen.vadishev@tmatesoft.com","sentAt":"2012-04-18T13:19:25Z","receivedAt":"2012-04-18T13:19:25Z","isPatch":false,"sender":{"key":"semen.vadishev@tmatesoft.com","avatar":null},"body":"Suppose one has a properly initialized submodule in a tree like this:\n\n$ git ls-tree HEAD\n100644 blob d208248ba4ab1d1791dc27f451dcaedb87dc19e1\t.gitmodules\n160000 commit ec633ea81e3cf64c3735ef4acd5ff9a490ed54eb\text\n100644 blob 597d6924118c00054efd526d9e48f68198f7da12\tfile.txt\n\n$ git show HEAD:.gitmodules\n[submodule \"ext\"]\n         path = ext\n         url = $URL\n\nThen one pulls a modification that replaces 'ext' gitlink by some blob \nor tree entry, but keeps '.gitmodules' the same:\n\n$ git ls-tree HEAD\n100644 blob d208248ba4ab1d1791dc27f451dcaedb87dc19e1\t.gitmodules\n040000 tree 82e3a754b6a0fcb238b03c0e47d05219fbf9cf89\text\n100644 blob 597d6924118c00054efd526d9e48f68198f7da12\tfile.txt\n\nAre there any possible downsides of such modification we should be aware of?\n\nThanks,\n\n-- \nSemen Vadishev,\nTMate Software,\nhttp://subgit.com/ - git+svn on the server side!\n"},{"id":"189628","messageId":"4F8EC4E2.6070507@web.de","threadId":"30277","inReplyTo":"4F8EBF5D.5070301@tmatesoft.com","subject":"Re: Delete gitlink entry but keep .gitmodules file unmodified","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2012-04-18T13:42:58Z","receivedAt":"2012-04-18T13:42:58Z","isPatch":false,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 18.04.2012 15:19, schrieb Semen Vadishev:\n> Suppose one has a properly initialized submodule in a tree like this:\n> \n> $ git ls-tree HEAD\n> 100644 blob d208248ba4ab1d1791dc27f451dcaedb87dc19e1    .gitmodules\n> 160000 commit ec633ea81e3cf64c3735ef4acd5ff9a490ed54eb    ext\n> 100644 blob 597d6924118c00054efd526d9e48f68198f7da12    file.txt\n> \n> $ git show HEAD:.gitmodules\n> [submodule \"ext\"]\n>         path = ext\n>         url = $URL\n> \n> Then one pulls a modification that replaces 'ext' gitlink by some blob or tree entry, but keeps '.gitmodules' the same:\n> \n> $ git ls-tree HEAD\n> 100644 blob d208248ba4ab1d1791dc27f451dcaedb87dc19e1    .gitmodules\n> 040000 tree 82e3a754b6a0fcb238b03c0e47d05219fbf9cf89    ext\n> 100644 blob 597d6924118c00054efd526d9e48f68198f7da12    file.txt\n> \n> Are there any possible downsides of such modification we should be aware of?\n\nYes, unfortunately current git isn't able to do that (even though work\nis ongoing to make future versions handle that just fine). Right now\nthe populated submodule \"ext\" won't be removed when you switch to a\nbranch where it doesn't exist. If the new branch has a tree there,\nyou'll almost certainly get an error when trying to switch to it as\nthat would overwrite files left over from the submodule (end even if\nit doesn't, you'll might get lots of untracked files in the tree\nafter the checkout).\n\nAs a workaround you could use a symbolic link (assuming you FS supports\nthat) and switch that around between two different directories:\n\n100644 .gitmodules\n100644 ext -> ext_sub\n160000 ext_sub\n\n100644 .gitmodules\n100644 ext -> ext_tree\n160000 ext_tree\n\nIf you then add ext_sub and ext_tree to the .gitignore of each side it\nisn't present in, everything should work just fine (and when git learns\nto handle that case, you can get rid of that workaround for future\ncommits).\n"},{"id":"189632","messageId":"4F8ED0F6.5070106@tmatesoft.com","threadId":"30277","inReplyTo":"4F8EC4E2.6070507@web.de","subject":"Re: Delete gitlink entry but keep .gitmodules file unmodified","fromName":"Semen Vadishev","fromEmail":"semen.vadishev@tmatesoft.com","sentAt":"2012-04-18T14:34:30Z","receivedAt":"2012-04-18T14:34:30Z","isPatch":false,"sender":{"key":"semen.vadishev@tmatesoft.com","avatar":null},"body":"> Yes, unfortunately current git isn't able to do that (even though work\n> is ongoing to make future versions handle that just fine). Right now\n> the populated submodule \"ext\" won't be removed when you switch to a\n> branch where it doesn't exist. If the new branch has a tree there,\n> you'll almost certainly get an error when trying to switch to it as\n> that would overwrite files left over from the submodule (end even if\n> it doesn't, you'll might get lots of untracked files in the tree\n> after the checkout).\nWe assume such modifications are rare enough, so this downside is fairly \nminor in our case.\n\nAnd what about these obsolete [submodule \"foo\"] sections left in \n.gitmodules and .git/config files? Do they bring any problems? Maybe for \nsome older git versions?\n\nThank you,\n\nSemen Vadishev,\nTMate Software,\nhttp://subgit.com/ - git+svn on the server side!\n\n\nOn 4/18/12 17:42, Jens Lehmann wrote:\n> Am 18.04.2012 15:19, schrieb Semen Vadishev:\n>> Suppose one has a properly initialized submodule in a tree like this:\n>>\n>> $ git ls-tree HEAD\n>> 100644 blob d208248ba4ab1d1791dc27f451dcaedb87dc19e1    .gitmodules\n>> 160000 commit ec633ea81e3cf64c3735ef4acd5ff9a490ed54eb    ext\n>> 100644 blob 597d6924118c00054efd526d9e48f68198f7da12    file.txt\n>>\n>> $ git show HEAD:.gitmodules\n>> [submodule \"ext\"]\n>>          path = ext\n>>          url = $URL\n>>\n>> Then one pulls a modification that replaces 'ext' gitlink by some blob or tree entry, but keeps '.gitmodules' the same:\n>>\n>> $ git ls-tree HEAD\n>> 100644 blob d208248ba4ab1d1791dc27f451dcaedb87dc19e1    .gitmodules\n>> 040000 tree 82e3a754b6a0fcb238b03c0e47d05219fbf9cf89    ext\n>> 100644 blob 597d6924118c00054efd526d9e48f68198f7da12    file.txt\n>>\n>> Are there any possible downsides of such modification we should be aware of?\n> Yes, unfortunately current git isn't able to do that (even though work\n> is ongoing to make future versions handle that just fine). Right now\n> the populated submodule \"ext\" won't be removed when you switch to a\n> branch where it doesn't exist. If the new branch has a tree there,\n> you'll almost certainly get an error when trying to switch to it as\n> that would overwrite files left over from the submodule (end even if\n> it doesn't, you'll might get lots of untracked files in the tree\n> after the checkout).\n>\n> As a workaround you could use a symbolic link (assuming you FS supports\n> that) and switch that around between two different directories:\n>\n> 100644 .gitmodules\n> 100644 ext ->  ext_sub\n> 160000 ext_sub\n>\n> 100644 .gitmodules\n> 100644 ext ->  ext_tree\n> 160000 ext_tree\n>\n> If you then add ext_sub and ext_tree to the .gitignore of each side it\n> isn't present in, everything should work just fine (and when git learns\n> to handle that case, you can get rid of that workaround for future\n> commits).\n"},{"id":"189689","messageId":"4F8FD6A2.5090605@web.de","threadId":"30277","inReplyTo":"4F8ED0F6.5070106@tmatesoft.com","subject":"Re: Delete gitlink entry but keep .gitmodules file unmodified","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2012-04-19T09:10:58Z","receivedAt":"2012-04-19T09:10:58Z","isPatch":false,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 18.04.2012 16:34, schrieb Semen Vadishev:\n> And what about these obsolete [submodule \"foo\"] sections left in .gitmodules and .git/config files? Do they bring any problems? Maybe for some older git versions?\n\nNone that I'm aware of, that should work just fine.\n"}]}