git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug: git-add .* errors out

From
Pranit Bauva <pranit.bauva@gmail.com>
Date
Sep 12, 2016, 05:59 UTC
Message-ID
<CAFZEwPN=gBdBPmyxRDz8yLfTKAcGjAwW_mVUDGe+83JUNc4L3g@mail.gmail.com>
In-Reply-To
<20160911193906.GC8254@hank>
Hey Thomas,
On Mon, Sep 12, 2016 at 1:09 AM, Thomas Gummerer <t.gummerer@gmail.com> wrote:
Show 21 quoted lines
> 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

Previous: Thomas Gummerer
Message 4 of 4 in “Bug: git-add .* errors out”
  1. Pranit BauvaSep 11, 2016
  2. Andreas SchwabSep 11, 2016
  3. Thomas GummererSep 11, 2016
  4. Pranit BauvaSep 12, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.