All of lore.kernel.org
 help / color / mirror / Atom feed
* Bug (or inconsistency) in git add
       [not found] <CADJEhEWC=mMManxi9Q6W9EvVKmTV=i1ZxbdW4QS_ou_DrBEb+Q@mail.gmail.com>
@ 2012-04-30  4:03 ` Steve Bennett
       [not found]   ` <CAA5Ydx9h6o=uppRk5zc9V4z1S831KGVRBzTw9oMqDjY34-noOw@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Bennett @ 2012-04-30  4:03 UTC (permalink / raw)
  To: git

I couldn't find a bug tracker for Git, so here's my bug report.

Given a directory containing foo/bar/baz/blah.py and
foo/bar/baz/blem.py, this command:
1)
git add foo/**/*.py

produces no output, and adds no files.

This command:
2)
git add /**.py

produces no output but adds all the files.

This command:
3)
git add foo/**.py

produces an error and adds no files.

IMHO, "git add" should always produce an error message if no files
matched the pathspec given. So case 1) should produce an error
message.

git version 1.7.9.4 on Snow Leopard. (There doesn't seem to be a
1.7.10 at http://code.google.com/p/git-osx-installer/downloads/list?can=3)

If this is some weird bash shell behaviour, my apologies.

Steve

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

* Re: Bug (or inconsistency) in git add
       [not found]   ` <CAA5Ydx9h6o=uppRk5zc9V4z1S831KGVRBzTw9oMqDjY34-noOw@mail.gmail.com>
@ 2012-04-30  6:46     ` Steve Bennett
  2012-04-30  7:02       ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Bennett @ 2012-04-30  6:46 UTC (permalink / raw)
  To: Victor Engmark; +Cc: git

On 30 April 2012 16:23, Victor Engmark <victor.engmark@gmail.com> wrote:
> I can't answer for the absence of an error when no files are added, but
> globbing (resolving * in paths) is done by the shell, not by git. To verify
> a glob, just echo it:
>
> echo foo/**/*.py

Yes, it appears that the two cases are treated differently:
1) foo/**/*.py:  the shell expands the **, and interprets it the same
as "*",  so foo/**/*.py means any python file exactly one directory
deeper than foo
2) /**.py: the shell ignores this and passes it straight to Git.

So I guess the missing error message I reported originally is
logically correct in a kind of convoluted way: the ** is actually
matching real files (just not the ones you expected) and they don't
have any changes, so you don't get any output.

(Whether or not it makes sense for Git to produce identical output in
the case of both adding files with changes, and doing nothing at all,
is a debate I probably shouldn't start...)

> If you want to add recursively, you'll need to enable the special behavior
> for double stars:
>
> shopt -s globstar

Looks like I need a newer version of Bash.

In any case, it looks like Git does support some ** globbing natively.
I'm curious about the rules for that. They don't seem to be documented
in the git man page (http://schacon.github.com/git/user-manual.html).

Steve

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

* Re: Bug (or inconsistency) in git add
  2012-04-30  6:46     ` Steve Bennett
@ 2012-04-30  7:02       ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2012-04-30  7:02 UTC (permalink / raw)
  To: Steve Bennett; +Cc: Victor Engmark, git

Steve Bennett <stevage@gmail.com> writes:

> In any case, it looks like Git does support some ** globbing natively.

No, we don't.

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

end of thread, other threads:[~2012-04-30  7:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CADJEhEWC=mMManxi9Q6W9EvVKmTV=i1ZxbdW4QS_ou_DrBEb+Q@mail.gmail.com>
2012-04-30  4:03 ` Bug (or inconsistency) in git add Steve Bennett
     [not found]   ` <CAA5Ydx9h6o=uppRk5zc9V4z1S831KGVRBzTw9oMqDjY34-noOw@mail.gmail.com>
2012-04-30  6:46     ` Steve Bennett
2012-04-30  7:02       ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.