# [BUG] git add . after removing .git/ in a subdirectory triggers assertion failure

2 messages from 2016-01-08 to 2016-01-08. Participants: Matthieu Moy, Duy Nguyen.
Thread: https://gitlist.dev/t/41149

## Matthieu Moy, 2016-01-08 11:33

Subject: [BUG] git add . after removing .git/ in a subdirectory triggers assertion failure
Message-ID: <vpqvb74fgr1.fsf@anie.imag.fr>
URL: https://gitlist.dev/e/vpqvb74fgr1.fsf%40anie.imag.fr

```
Hi,

No time to debug this for now, but I have a reproduction script:

mkdir test && cd test
git init sub   
cd sub/
touch foo && git add . && git commit -m"foo"
cd ..
git init
git add sub 
rm -fr sub/.git/
cd sub/
git add .

In short, sub used to be a submodule, but we removed the .git/ and tried
to "git add ." the result.

The last line triggers this:

git: pathspec.c:317: prefix_pathspec: Assertion `item->nowildcard_len <= item->len && item->prefix <= item->len' failed.

Cheers,

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Duy Nguyen, 2016-01-08 12:10

Subject: Re: [BUG] git add . after removing .git/ in a subdirectory triggers assertion failure
Message-ID: <CACsJy8C+7PpsOxY=_WXNdzAvrZ=KKsHc1G=2DdmNO1_D8fbhig@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8C%2B7PpsOxY%3D_WXNdzAvrZ%3DKKsHc1G%3D2DdmNO1_D8fbhig%40mail.gmail.com
In-Reply-To: <vpqvb74fgr1.fsf@anie.imag.fr>

```
On Fri, Jan 8, 2016 at 6:33 PM, Matthieu Moy
<Matthieu.Moy@grenoble-inp.fr> wrote:
> Hi,
>
> No time to debug this for now, but I have a reproduction script:
>
> mkdir test && cd test
> git init sub
> cd sub/
> touch foo && git add . && git commit -m"foo"
> cd ..
> git init
> git add sub
> rm -fr sub/.git/
> cd sub/
> git add .
>
> In short, sub used to be a submodule, but we removed the .git/ and tried
> to "git add ." the result.
>
> The last line triggers this:
>
> git: pathspec.c:317: prefix_pathspec: Assertion `item->nowildcard_len <= item->len && item->prefix <= item->len' failed.

Reported twice in the past and I failed to provide a proper fix:

http://thread.gmane.org/gmane.comp.version-control.git/267095/focus=267404
-- 
Duy

```
