# Regression in `git add' in 1.7's 48ffef966c with a wildcard in .gitignore

4 messages from 2010-03-08 to 2010-03-08. Participants: Ævar Arnfjörð Bjarmason, Michael J Gruber, Junio C Hamano.
Thread: https://gitlist.dev/t/22953

## Ævar Arnfjörð Bjarmason, 2010-03-08 17:08

Subject: Regression in `git add' in 1.7's 48ffef966c with a wildcard in .gitignore
Message-ID: <51dd1af81003080908i3bc94f27lc99e146bb57993ba@mail.gmail.com>
URL: https://gitlist.dev/e/51dd1af81003080908i3bc94f27lc99e146bb57993ba%40mail.gmail.com

```
I've discovered a regression in git-add the 1.7 release which I can't
see reported anywhere. It was introduced in
48ffef966c762578eb818c0c54a7e11dd054f5db by Junio C Hamano at Fri Jan
8 23:05:41 2010.

The problem is that when you have a .gitignore file with * in it
git-add will only complain that you're trying to add ignored files if
they're in the top level of your repository, for files in
subdirectories it now just silently fails:

    $ mkdir test && cd test && git init
    $ echo "*" > .gitignore
    $ mkdir directory && touch foo directory/foo

So far so good, now if I try to add 'foo' I get an error from both 1.6 and 1.7:

    $ git add foo
    The following paths are ignored by one of your .gitignore files:
    foo

But 1.7 just silently fails to add directory/foo to the index:

    $ git add directory/foo
    $ echo $?
    0

1.6 however does the right thing:

    $ git add directory/foo
    The following paths are ignored by one of your .gitignore files:
    directory/foo
    $ echo $?
    128

A test script / bisect script I used is available at
git://github.com/avar/git-add-fail.git I couldn't figure out how to
turn it into a Git test.

```

## Michael J Gruber, 2010-03-08 20:06

Subject: Re: Regression in `git add' in 1.7's 48ffef966c with a wildcard in .gitignore
Message-ID: <4B9558AA.90907@drmicha.warpmail.net>
URL: https://gitlist.dev/e/4B9558AA.90907%40drmicha.warpmail.net
In-Reply-To: <51dd1af81003080908i3bc94f27lc99e146bb57993ba@mail.gmail.com>

```
Ævar Arnfjörð Bjarmason venit, vidit, dixit 08.03.2010 18:08:
> I've discovered a regression in git-add the 1.7 release which I can't
> see reported anywhere. It was introduced in
> 48ffef966c762578eb818c0c54a7e11dd054f5db by Junio C Hamano at Fri Jan
> 8 23:05:41 2010.
> 
> The problem is that when you have a .gitignore file with * in it
> git-add will only complain that you're trying to add ignored files if
> they're in the top level of your repository, for files in
> subdirectories it now just silently fails:
> 
>     $ mkdir test && cd test && git init
>     $ echo "*" > .gitignore
>     $ mkdir directory && touch foo directory/foo

Could this possibly be fixed by 13bb0ce (builtin-add: fix exclude
handling, 2010-02-28) which is on pu?

Michael

```

## Junio C Hamano, 2010-03-08 20:20

Subject: Re: Regression in `git add' in 1.7's 48ffef966c with a wildcard in .gitignore
Message-ID: <7vzl2ir2ep.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vzl2ir2ep.fsf%40alter.siamese.dyndns.org
In-Reply-To: <51dd1af81003080908i3bc94f27lc99e146bb57993ba@mail.gmail.com>

```
I think this is the same one as what we discussed earlier.  Does 13bb0ce
(builtin-add: fix exclude handling, 2010-02-28) that is already queued in
'pu' help?

```

## Ævar Arnfjörð Bjarmason, 2010-03-08 20:21

Subject: Re: Regression in `git add' in 1.7's 48ffef966c with a wildcard in .gitignore
Message-ID: <51dd1af81003081221xfd1a383tb411eeb1146bc67@mail.gmail.com>
URL: https://gitlist.dev/e/51dd1af81003081221xfd1a383tb411eeb1146bc67%40mail.gmail.com
In-Reply-To: <4B9558AA.90907@drmicha.warpmail.net>

```
On Mon, Mar 8, 2010 at 20:06, Michael J Gruber <git@drmicha.warpmail.net> wrote:
> Ævar Arnfjörð Bjarmason venit, vidit, dixit 08.03.2010 18:08:
> Could this possibly be fixed by 13bb0ce (builtin-add: fix exclude
> handling, 2010-02-28) which is on pu?

Yes. I just compiled pu and the issue with git-add is indeed fixed in
13bb0ce, thanks.

```
