Git development
 help / color / mirror / Atom feed
* Doing a git add '' will add more files then expected
@ 2014-11-17 16:25 Guilherme
  2014-11-17 18:15 ` Andreas Schwab
  0 siblings, 1 reply; 5+ messages in thread
From: Guilherme @ 2014-11-17 16:25 UTC (permalink / raw)
  To: git

Hello,

I first asked on stackoverflow
(http://stackoverflow.com/questions/26933761/python-sh-module-and-git-try-to-add-more-files-then-in-command/26934517#26934517)
about this behaviour.

Then on the conversation that happened on the git-users mailing list
other agreed that this behaviour is probably not as intended.

Steps to reproduce:
In bash (not sure this is bash specific) do:
git add ''
(that's to apostrophes, an empty argument)

Results
same as doing git add .

Expected
no files added or error about not finding file ''

Hope this helps.
Guilherme

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

* Re: Doing a git add '' will add more files then expected
  2014-11-17 16:25 Doing a git add '' will add more files then expected Guilherme
@ 2014-11-17 18:15 ` Andreas Schwab
  2014-11-17 18:42   ` Matthieu Moy
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2014-11-17 18:15 UTC (permalink / raw)
  To: Guilherme; +Cc: git

Guilherme <guibufolo@gmail.com> writes:

> Steps to reproduce:
> In bash (not sure this is bash specific) do:
> git add ''
> (that's to apostrophes, an empty argument)
>
> Results
> same as doing git add .
>
> Expected
> no files added or error about not finding file ''

The argument to git add is a pathspec, and the empty pathspec matches
all files.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Doing a git add '' will add more files then expected
  2014-11-17 18:15 ` Andreas Schwab
@ 2014-11-17 18:42   ` Matthieu Moy
  2014-11-17 19:08     ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Matthieu Moy @ 2014-11-17 18:42 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Guilherme, git

Andreas Schwab <schwab@linux-m68k.org> writes:

> The argument to git add is a pathspec, and the empty pathspec matches
> all files.

Err, why does the empty pathspec match all files? Isn't that a bug?

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

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

* Re: Doing a git add '' will add more files then expected
  2014-11-17 18:42   ` Matthieu Moy
@ 2014-11-17 19:08     ` Junio C Hamano
  2014-11-23 19:06       ` Javier Domingo Cansino
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2014-11-17 19:08 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: Andreas Schwab, Guilherme, git

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

> Andreas Schwab <schwab@linux-m68k.org> writes:
>
>> The argument to git add is a pathspec, and the empty pathspec matches
>> all files.
>
> Err, why does the empty pathspec match all files? Isn't that a bug?

That is debatable.

    cd Documentation
    git add "a"

would be equivalent to typing

    git add Documentation/"a"

so

    cd Documentation
    git add ""

would be equivalent to typing

    git add Documentation/""

And doing the same from the top-level of the working tree can be
argued to be a natural extension.

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

* Re: Doing a git add '' will add more files then expected
  2014-11-17 19:08     ` Junio C Hamano
@ 2014-11-23 19:06       ` Javier Domingo Cansino
  0 siblings, 0 replies; 5+ messages in thread
From: Javier Domingo Cansino @ 2014-11-23 19:06 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Matthieu Moy, Andreas Schwab, Guilherme, git@vger.kernel.org

IMO, if you put an empty string "" you would be implying the same as
with a dot (git add . ).

The important thing is that "git add" without a pathspec returns an
error, as it has always done, mainly because it people tend to work
without gitignoring all the files they should, and allowing such
behaviour would make things harder.

-- 
Javier Domingo Cansino

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

end of thread, other threads:[~2014-11-23 19:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-17 16:25 Doing a git add '' will add more files then expected Guilherme
2014-11-17 18:15 ` Andreas Schwab
2014-11-17 18:42   ` Matthieu Moy
2014-11-17 19:08     ` Junio C Hamano
2014-11-23 19:06       ` Javier Domingo Cansino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox