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

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Matthieu Moy-2
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/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

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

Junio C Hamano
Matthieu Moy <[hidden email]> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

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

Matthieu Moy-2
Junio C Hamano <[hidden email]> writes:

> Matthieu Moy <[hidden email]> 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/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reply | Threaded
Open this post in threaded view
|

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

Clemens Buchacher
In reply to this post by Junio C Hamano
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: <[hidden email]>
        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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html