# Behavior of 'git add \*.txt': bug or feature?

4 messages from 2009-09-16 to 2009-09-17. Participants: Matthieu Moy, Junio C Hamano, Clemens Buchacher.
Thread: https://gitlist.dev/t/20975

## Matthieu Moy, 2009-09-16 19:46

Subject: Behavior of 'git add \*.txt': bug or feature?
Message-ID: <vpqljke7jv8.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqljke7jv8.fsf%40bauges.imag.fr

```
Hi,

I find the behavior of 'git add \*.txt' strange: for adding untracked
files, it considers \*.txt as a pattern to match, but for updating
existing file's staged content, it seems to consider it as a filename:

$ git status
# On branch master
# Changed but not updated:
#
#       modified:   three.txt
#       modified:   two.txt
#
# Untracked files:
#
#       one.txt
no changes added to commit (use "git add" and/or "git commit -a")
$ git add -v '*.txt'
add 'one.txt'
$ git add -v '*.txt'
$ 

I would have expected this "git add -v '*.txt'" to update the staged
content of two.txt and three.txt too.

It this the intended behavior? If so, what's the rationale for this?

Thanks,

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

```

## Junio C Hamano, 2009-09-16 20:30

Subject: Re: Behavior of 'git add \*.txt': bug or feature?
Message-ID: <7vbplazl7s.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vbplazl7s.fsf%40alter.siamese.dyndns.org
In-Reply-To: <vpqljke7jv8.fsf@bauges.imag.fr>

```
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:

> It this the intended behavior? If so, what's the rationale for this?

I strongly suspect that it comes from the fact that we have two
definitions and three implementations of pathspec-aware tree traversal.
One family is unaware of shell-glob wildcards (they only do leading
directory path match) while the other know both leading directory path and
shell-glob.

It is on the list of long-term items to fix, as the change required is
quite involved.

```

## Matthieu Moy, 2009-09-16 21:26

Subject: Re: Behavior of 'git add \*.txt': bug or feature?
Message-ID: <vpqr5u637kb.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqr5u637kb.fsf%40bauges.imag.fr
In-Reply-To: <7vbplazl7s.fsf@alter.siamese.dyndns.org>

```
Junio C Hamano <gitster@pobox.com> writes:

> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
>
>> It this the intended behavior? If so, what's the rationale for this?
>
> I strongly suspect that it comes from the fact that we have two
> definitions and three implementations of pathspec-aware tree traversal.
> One family is unaware of shell-glob wildcards (they only do leading
> directory path match) while the other know both leading directory path and
> shell-glob.
>
> It is on the list of long-term items to fix, as the change required is
> quite involved.

OK, that answers my question.

Thanks,

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

```

## Clemens Buchacher, 2009-09-17 14:25

Subject: Re: Behavior of 'git add \*.txt': bug or feature?
Message-ID: <20090917142526.GA28878@localhost>
URL: https://gitlist.dev/e/20090917142526.GA28878%40localhost
In-Reply-To: <7vbplazl7s.fsf@alter.siamese.dyndns.org>

```
On Wed, Sep 16, 2009 at 01:30:15PM -0700, Junio C Hamano wrote:

> I strongly suspect that it comes from the fact that we have two
> definitions and three implementations of pathspec-aware tree traversal.
> One family is unaware of shell-glob wildcards (they only do leading
> directory path match) while the other know both leading directory path and
> shell-glob.

We had a discussion about this in January:

	Subject: Re: [PATCH 3/3] implement pattern matching in ce_path_match
	Message-ID: <7vljtd20m6.fsf@gitster.siamese.dyndns.org>
	http://article.gmane.org/gmane.comp.version-control.git/105679

I was going to fix it, but motivation left me after the above discussion,
since I don't really care about this feature.

Clemens

```
