git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* A couple errors dealing with uninitialized submodules
@ 2016-10-20 23:29 Aaron Schrab
  2016-10-20 23:51 ` Stefan Beller
  0 siblings, 1 reply; 2+ messages in thread
From: Aaron Schrab @ 2016-10-20 23:29 UTC (permalink / raw)
  To: git@vger.kernel.org

I was working with a fresh clone of a repository where I'd forgotten 
that one of the directories was setup as a submodule, so I hadn't 
initialized it.

I tried to add a symlink to a location outside the repository and this 
failed with an assertion (exact text in comment below). When looking 
into that I realized that the directory was meant to be a submodule and 
decided to try to change that.  So I tried to remove the submodule, and 
got an error (misleadingly) saying that couldn't be done because it uses 
a .git directory.

I first noticed this with git 2.9.3 from Debian unstable, but I also see 
it building from v2.10.1-502-g6598894 fetched from master recently.

The following script replicates both of these issues. These could both 
be classified as "don't do that", although at lease the assertion is 
quite ugly.

--- >8 ----
#!/bin/sh -e

directory=$(mktemp -d)
echo "Using directory '$directory'"
cd $directory
git init --quiet orig
(
  cd orig
  # Using a random, small repository for the submodule.
  git submodule --quiet add https://github.com/diepm/vim-rest-console.git sub
  git commit -m init >/dev/null
)
git clone --quiet orig dup
cd dup

(
  cd sub
  ln -s /tmp/dont_care
  # Next command aborts with
  # git: pathspec.c:317: prefix_pathspec: Assertion `item->nowildcard_len <= item->len && item->prefix <= item->len' failed.`
  git add . || : expected to fail
)

rm -f .git/index.lock
# Next command fails with error wrongly saying that the submodule uses a .git
# directory.  I believe that the real problem is that the uninitialized
# submodule has content.
git rm sub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: A couple errors dealing with uninitialized submodules
  2016-10-20 23:29 A couple errors dealing with uninitialized submodules Aaron Schrab
@ 2016-10-20 23:51 ` Stefan Beller
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Beller @ 2016-10-20 23:51 UTC (permalink / raw)
  To: Aaron Schrab; +Cc: git@vger.kernel.org

On Thu, Oct 20, 2016 at 4:29 PM, Aaron Schrab <aaron@schrab.com> wrote:
> I was working with a fresh clone of a repository where I'd forgotten that
> one of the directories was setup as a submodule, so I hadn't initialized it.
>
> I tried to add a symlink to a location outside the repository and this
> failed with an assertion (exact text in comment below). When looking into
> that I realized that the directory was meant to be a submodule and decided
> to try to change that.  So I tried to remove the submodule, and got an error
> (misleadingly) saying that couldn't be done because it uses a .git
> directory.
>
> I first noticed this with git 2.9.3 from Debian unstable, but I also see it
> building from v2.10.1-502-g6598894 fetched from master recently.
>
> The following script replicates both of these issues. These could both be
> classified as "don't do that", although at lease the assertion is quite
> ugly.
>
> --- >8 ----
> #!/bin/sh -e
>
> directory=$(mktemp -d)
> echo "Using directory '$directory'"
> cd $directory
> git init --quiet orig
> (
>  cd orig
>  # Using a random, small repository for the submodule.
>  git submodule --quiet add https://github.com/diepm/vim-rest-console.git sub
>  git commit -m init >/dev/null
> )
> git clone --quiet orig dup
> cd dup
>
> (
>  cd sub
>  ln -s /tmp/dont_care
>  # Next command aborts with
>  # git: pathspec.c:317: prefix_pathspec: Assertion `item->nowildcard_len <=
> item->len && item->prefix <= item->len' failed.`

For this bug see
https://public-inbox.org/git/CAFOYHZDw-P0ST8WKoSVxBpbFCiACZpgiDPMfw5MRtFTMosO0rg@mail.gmail.com/
Specifically try this patch
https://public-inbox.org/git/CAGZ79kZaZCwZ-cesB_voq0s0Qt+ipcgb6TkdzLE+EWSF_qRj7A@mail.gmail.com/

>  git add . || : expected to fail
> )
>
> rm -f .git/index.lock
> # Next command fails with error wrongly saying that the submodule uses a
> .git
> # directory.  I believe that the real problem is that the uninitialized
> # submodule has content.
> git rm sub

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-20 23:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-20 23:29 A couple errors dealing with uninitialized submodules Aaron Schrab
2016-10-20 23:51 ` Stefan Beller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).