{"thread":{"id":"44345","subject":"A couple errors dealing with uninitialized submodules","startedAt":"2016-10-20T23:36:20Z","lastAt":"2016-10-20T23:51:13Z","messageCount":2,"participants":["Aaron Schrab","Stefan Beller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"304546","messageId":"20161020232915.GB3667@pug.qqx.org","threadId":"44345","inReplyTo":null,"subject":"A couple errors dealing with uninitialized submodules","fromName":"Aaron Schrab","fromEmail":"aaron@schrab.com","sentAt":"2016-10-20T23:29:15Z","receivedAt":"2016-10-20T23:36:20Z","isPatch":false,"sender":{"key":"aaron@schrab.com","avatar":"https://avatars.githubusercontent.com/u/39620?v=4"},"body":"I was working with a fresh clone of a repository where I'd forgotten \nthat one of the directories was setup as a submodule, so I hadn't \ninitialized it.\n\nI tried to add a symlink to a location outside the repository and this \nfailed with an assertion (exact text in comment below). When looking \ninto that I realized that the directory was meant to be a submodule and \ndecided to try to change that.  So I tried to remove the submodule, and \ngot an error (misleadingly) saying that couldn't be done because it uses \na .git directory.\n\nI first noticed this with git 2.9.3 from Debian unstable, but I also see \nit building from v2.10.1-502-g6598894 fetched from master recently.\n\nThe following script replicates both of these issues. These could both \nbe classified as \"don't do that\", although at lease the assertion is \nquite ugly.\n\n--- >8 ----\n#!/bin/sh -e\n\ndirectory=$(mktemp -d)\necho \"Using directory '$directory'\"\ncd $directory\ngit init --quiet orig\n(\n  cd orig\n  # Using a random, small repository for the submodule.\n  git submodule --quiet add https://github.com/diepm/vim-rest-console.git sub\n  git commit -m init >/dev/null\n)\ngit clone --quiet orig dup\ncd dup\n\n(\n  cd sub\n  ln -s /tmp/dont_care\n  # Next command aborts with\n  # git: pathspec.c:317: prefix_pathspec: Assertion `item->nowildcard_len <= item->len && item->prefix <= item->len' failed.`\n  git add . || : expected to fail\n)\n\nrm -f .git/index.lock\n# Next command fails with error wrongly saying that the submodule uses a .git\n# directory.  I believe that the real problem is that the uninitialized\n# submodule has content.\ngit rm sub\n"},{"id":"304548","messageId":"CAGZ79kY69xtmPrwXWk6O6iSAYnViaO_R6_QY4KaX+qF51ouD6Q@mail.gmail.com","threadId":"44345","inReplyTo":"20161020232915.GB3667@pug.qqx.org","subject":"Re: A couple errors dealing with uninitialized submodules","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-10-20T23:51:06Z","receivedAt":"2016-10-20T23:51:13Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Thu, Oct 20, 2016 at 4:29 PM, Aaron Schrab <aaron@schrab.com> wrote:\n> I was working with a fresh clone of a repository where I'd forgotten that\n> one of the directories was setup as a submodule, so I hadn't initialized it.\n>\n> I tried to add a symlink to a location outside the repository and this\n> failed with an assertion (exact text in comment below). When looking into\n> that I realized that the directory was meant to be a submodule and decided\n> to try to change that.  So I tried to remove the submodule, and got an error\n> (misleadingly) saying that couldn't be done because it uses a .git\n> directory.\n>\n> I first noticed this with git 2.9.3 from Debian unstable, but I also see it\n> building from v2.10.1-502-g6598894 fetched from master recently.\n>\n> The following script replicates both of these issues. These could both be\n> classified as \"don't do that\", although at lease the assertion is quite\n> ugly.\n>\n> --- >8 ----\n> #!/bin/sh -e\n>\n> directory=$(mktemp -d)\n> echo \"Using directory '$directory'\"\n> cd $directory\n> git init --quiet orig\n> (\n>  cd orig\n>  # Using a random, small repository for the submodule.\n>  git submodule --quiet add https://github.com/diepm/vim-rest-console.git sub\n>  git commit -m init >/dev/null\n> )\n> git clone --quiet orig dup\n> cd dup\n>\n> (\n>  cd sub\n>  ln -s /tmp/dont_care\n>  # Next command aborts with\n>  # git: pathspec.c:317: prefix_pathspec: Assertion `item->nowildcard_len <=\n> item->len && item->prefix <= item->len' failed.`\n\nFor this bug see\nhttps://public-inbox.org/git/CAFOYHZDw-P0ST8WKoSVxBpbFCiACZpgiDPMfw5MRtFTMosO0rg@mail.gmail.com/\nSpecifically try this patch\nhttps://public-inbox.org/git/CAGZ79kZaZCwZ-cesB_voq0s0Qt+ipcgb6TkdzLE+EWSF_qRj7A@mail.gmail.com/\n\n>  git add . || : expected to fail\n> )\n>\n> rm -f .git/index.lock\n> # Next command fails with error wrongly saying that the submodule uses a\n> .git\n> # directory.  I believe that the real problem is that the uninitialized\n> # submodule has content.\n> git rm sub\n"}]}