git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug: git-add .* errors out
@ 2016-09-11 19:10 Pranit Bauva
  2016-09-11 19:34 ` Andreas Schwab
  2016-09-11 19:39 ` Thomas Gummerer
  0 siblings, 2 replies; 4+ messages in thread
From: Pranit Bauva @ 2016-09-11 19:10 UTC (permalink / raw)
  To: Git List

Hey everyone,

One of my friend was trying to add files using the command `git add
.*` and got an error that "fatal: ..: '..' is outside repository"
which did seem a little obvious to me. But then I tried to reproduce
it in my machine with `git add ".*"` and it didn't error out. I am
currently using git 2.9.3 on Ubuntu 15.04 while he is using git 1.9.1
on Ubuntu 16.04. What might have gone wrong?

Regards,
Pranit Bauva

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

* Re: Bug: git-add .* errors out
  2016-09-11 19:10 Bug: git-add .* errors out Pranit Bauva
@ 2016-09-11 19:34 ` Andreas Schwab
  2016-09-11 19:39 ` Thomas Gummerer
  1 sibling, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2016-09-11 19:34 UTC (permalink / raw)
  To: Pranit Bauva; +Cc: Git List

On Sep 12 2016, Pranit Bauva <pranit.bauva@gmail.com> wrote:

> One of my friend was trying to add files using the command `git add
> .*` and got an error that "fatal: ..: '..' is outside repository"
> which did seem a little obvious to me. But then I tried to reproduce
> it in my machine with `git add ".*"` and it didn't error out.

Probably you were running it in a subdirectory.

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] 4+ messages in thread

* Re: Bug: git-add .* errors out
  2016-09-11 19:10 Bug: git-add .* errors out Pranit Bauva
  2016-09-11 19:34 ` Andreas Schwab
@ 2016-09-11 19:39 ` Thomas Gummerer
  2016-09-12  5:59   ` Pranit Bauva
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Gummerer @ 2016-09-11 19:39 UTC (permalink / raw)
  To: Pranit Bauva; +Cc: Git List

Hi,

On 09/12, Pranit Bauva wrote:
> Hey everyone,
> 
> One of my friend was trying to add files using the command `git add
> .*` and got an error that "fatal: ..: '..' is outside repository"
> which did seem a little obvious to me. But then I tried to reproduce
> it in my machine with `git add ".*"` and it didn't error out. I am
> currently using git 2.9.3 on Ubuntu 15.04 while he is using git 1.9.1
> on Ubuntu 16.04. What might have gone wrong?

The difference seems to be that you quoted the .*, which leaves the .*
in place for gits internal pathspec machinery, which then only
considers paths inside of the repository.

The non quoted version your friend used meanwhile is expanded by the
shell itself, which seems to be expanding it to ., the current
directory, and .., the parent directory.  This behaviour also depends
on the shell used, for me .* in bash includes the current as well as
the parent directory, while .* in zsh doesn't include either of these.

> Regards,
> Pranit Bauva

Hope this helps,
Thomas

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

* Re: Bug: git-add .* errors out
  2016-09-11 19:39 ` Thomas Gummerer
@ 2016-09-12  5:59   ` Pranit Bauva
  0 siblings, 0 replies; 4+ messages in thread
From: Pranit Bauva @ 2016-09-12  5:59 UTC (permalink / raw)
  To: Thomas Gummerer; +Cc: Git List

Hey Thomas,

On Mon, Sep 12, 2016 at 1:09 AM, Thomas Gummerer <t.gummerer@gmail.com> wrote:
> Hi,
>
> On 09/12, Pranit Bauva wrote:
>> Hey everyone,
>>
>> One of my friend was trying to add files using the command `git add
>> .*` and got an error that "fatal: ..: '..' is outside repository"
>> which did seem a little obvious to me. But then I tried to reproduce
>> it in my machine with `git add ".*"` and it didn't error out. I am
>> currently using git 2.9.3 on Ubuntu 15.04 while he is using git 1.9.1
>> on Ubuntu 16.04. What might have gone wrong?
>
> The difference seems to be that you quoted the .*, which leaves the .*
> in place for gits internal pathspec machinery, which then only
> considers paths inside of the repository.
>
> The non quoted version your friend used meanwhile is expanded by the
> shell itself, which seems to be expanding it to ., the current
> directory, and .., the parent directory.  This behaviour also depends
> on the shell used, for me .* in bash includes the current as well as
> the parent directory, while .* in zsh doesn't include either of these.

This seems to be a reasonable reason. I had guessed the behaviour of
the shell but didn't really know what was happening with the quoted
version. And I guess it cannot really be fixed because it depends on
the shell. I tried it out on bash though forgot to mention it. Thanks
for the help!

Regards,
Pranit Bauva

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

end of thread, other threads:[~2016-09-12  5:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-11 19:10 Bug: git-add .* errors out Pranit Bauva
2016-09-11 19:34 ` Andreas Schwab
2016-09-11 19:39 ` Thomas Gummerer
2016-09-12  5:59   ` Pranit Bauva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).