Re: [git-users] What is the difference between * and \*

2017-01-10 Thread Fernando A. Rodriguez
Thanks guys

2017-01-09 3:51 GMT-03:00 Konstantin Khomoutov <
flatw...@users.sourceforge.net>:

> On Mon, 9 Jan 2017 09:26:15 +0300
> Konstantin Khomoutov  wrote:
>
> > On Sun, 8 Jan 2017 09:54:30 -0800
> > Michael  wrote:
> >
> > > So, the question of "which form to use on windows" depends if you
> > > are using git for windows with the normal windows shell, or if you
> > > are using git for windows with cygwin and the bash shell?
> >
> > Sounds about correct.  "Native" Windows shells should pass wildcards
> > to Git commands unmodified, and Git will take care of their
> > expansions by itself.
>
> Well, there's yet one more point I forgot to formulate while having it
> on my mind actually.  Since Windows port of Git _has to_ deal with the
> fact Windows shells don't expand fileglobs, it definitely has some
> layer which deals with command-line processing.  A possible issue is
> that GfW uses MinGW to compile its core components (written in C), and
> MinGW should supposedly have some means to make non-Windows programs
> being ported on Windows "feel at home" with regard to parsing
> commad-line arguments.  Hence there might be some layer provided by
> MinGW which deals with fileglobs before core Git code has a chance to
> get its hands on them.  I don't know for sure how exactly this is
> currently implemented, so I'd ask on the GfW's mailing list for details.
>
> [...]
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] What is the difference between * and \*

2017-01-08 Thread Konstantin Khomoutov
On Mon, 9 Jan 2017 09:26:15 +0300
Konstantin Khomoutov  wrote:

> On Sun, 8 Jan 2017 09:54:30 -0800
> Michael  wrote:
> 
> > So, the question of "which form to use on windows" depends if you
> > are using git for windows with the normal windows shell, or if you
> > are using git for windows with cygwin and the bash shell?
> 
> Sounds about correct.  "Native" Windows shells should pass wildcards
> to Git commands unmodified, and Git will take care of their
> expansions by itself.

Well, there's yet one more point I forgot to formulate while having it
on my mind actually.  Since Windows port of Git _has to_ deal with the
fact Windows shells don't expand fileglobs, it definitely has some
layer which deals with command-line processing.  A possible issue is
that GfW uses MinGW to compile its core components (written in C), and
MinGW should supposedly have some means to make non-Windows programs
being ported on Windows "feel at home" with regard to parsing
commad-line arguments.  Hence there might be some layer provided by
MinGW which deals with fileglobs before core Git code has a chance to
get its hands on them.  I don't know for sure how exactly this is
currently implemented, so I'd ask on the GfW's mailing list for details.

[...]

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] What is the difference between * and \*

2017-01-08 Thread Konstantin Khomoutov
On Mon, 9 Jan 2017 09:26:15 +0300
Konstantin Khomoutov  wrote:

> On Sun, 8 Jan 2017 09:54:30 -0800
> Michael  wrote:
> 
> > So, the question of "which form to use on windows" depends if you
> > are using git for windows with the normal windows shell, or if you
> > are using git for windows with cygwin and the bash shell?
> 
> Sounds about correct.  "Native" Windows shells should pass wildcards
> to Git commands unmodified, and Git will take care of their
> expansions by itself.
> 
> Git Bash and Cygwin will expand the globs themselves, unless escaped.
> And when they are escaped, some Git commands will expand these globs
> themselves.  Unfortunately, my memory fails to provide the fine
> details on when Git commands do this.

The wording of `git help cli` is vague:

| Many commands allow wildcards in paths, but you need to
| protect them from getting globbed by the shell. These two mean
| different things:
|
| $ git checkout -- *.c
| $ git checkout -- \*.c
|
| The former lets your shell expand the fileglob, and you are
| asking the dot-C files in your working tree to be overwritten with the
| version in the index. The latter passes the *.c to Git, and you are
| asking the paths in the index that match the pattern to be checked out
| to your working tree. After running git add hello.c; rm hello.c, you
| will not see hello.c in your working tree with the former, but with
| the latter you will.

So, well, "many commands" FWIW ;-)

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] What is the difference between * and \*

2017-01-08 Thread Konstantin Khomoutov
On Sun, 8 Jan 2017 09:54:30 -0800
Michael  wrote:

> So, the question of "which form to use on windows" depends if you are
> using git for windows with the normal windows shell, or if you are
> using git for windows with cygwin and the bash shell?

Sounds about correct.  "Native" Windows shells should pass wildcards to
Git commands unmodified, and Git will take care of their expansions by
itself.

Git Bash and Cygwin will expand the globs themselves, unless escaped.
And when they are escaped, some Git commands will expand these globs
themselves.  Unfortunately, my memory fails to provide the fine details
on when Git commands do this.

[...]

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] What is the difference between * and \*

2017-01-08 Thread Michael
So, the question of "which form to use on windows" depends if you are using git 
for windows with the normal windows shell, or if you are using git for windows 
with cygwin and the bash shell?


On 2017-01-08, at 9:06 AM, Konstantin Khomoutov 
 wrote:

> On Sun, 8 Jan 2017 07:42:45 -0800 (PST)
> Fernando Rodriguez  wrote:
> 
>> I've seen the command
>> 
>> git rm log/\*.log
>> 
>> at [1] , my questions is what is the difference by just doing
>> 
>> git rm log/*.log
>> 
>> I'm using a windows version for git and I don't see any difference.
> 
> This might explain your observation.
> 
> The "standard" shells on Unix-like operating systems perform so-called
> pathname expansions by themselves.  This means, when you call
> 
>  git rm log/*.log
> 
> in a shell running on a Unix-like OS, the shell will take that
> 
>  log/*.log
> 
> pattern and would attempt to expand it by itself--by looking under the
> "log" directory, enumerating all the files matching the "*.log" pattern
> there and--should this succeed--replace the original pattern string
> with one or more *distinct* arguments--the results of the expansion.
> 
> Say, if there were files 1.log, 2.log and 3.log under the "log"
> directory at the time of the call, the `git rm` command would receive
> three distinct arguments: "log/1.log", "log/2.log" and "log/3.log".
> 
> (If the expansion would fail--that is, no matching entities would have
> been found, the shell would pass the source pattern "as is" to the
> command it would call.)
> 
> On Windows, shells do not do pathname expansion; they don't even do
> basic grouping of characters, and a Windows process, when it starts,
> receives either one command line argument -- with all the stuff
> specified on its command line being passed as is, or none at all (if
> nothing was specified by the user).  It's then the process's own
> responsibility to parse that stuff however it sees fit.  (The
> programming language the program being called is written in typically
> offers some help with this in its standard library.  Unfortunately,
> differences in these implementations do exist even between different
> versions of the standard C library between different releases of that
> library.)
> 
> That was for the first part.  The second part is that certain Git
> commands are able to expand globs (those "*" and "**" specs) in
> pathnames by themselves.  To do this, you need to "protect" them from
> expansion by the shell.  The backslash before the '*' character makes
> the Unix-compatible shell turn the whole sequence "\*" into just '*'
> while ignoring the special meaning of it.
> 
> Note that using "\*" on Windows supposes you're doing that in the Git
> Bash shell -- which is a port of the (Unix-y) bash shell; the stock
> Windows shells know nothing about the backslash quoting.
> 
>> [1] 
>> https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Git for human beings" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to git-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

---
Entertaining minecraft videos
http://YouTube.com/keybounce

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] What is the difference between * and \*

2017-01-08 Thread Konstantin Khomoutov
On Sun, 8 Jan 2017 07:42:45 -0800 (PST)
Fernando Rodriguez  wrote:

> I've seen the command
> 
>  git rm log/\*.log
> 
>  at [1] , my questions is what is the difference by just doing
> 
>  git rm log/*.log
> 
> I'm using a windows version for git and I don't see any difference.

This might explain your observation.

The "standard" shells on Unix-like operating systems perform so-called
pathname expansions by themselves.  This means, when you call

  git rm log/*.log

in a shell running on a Unix-like OS, the shell will take that

  log/*.log

pattern and would attempt to expand it by itself--by looking under the
"log" directory, enumerating all the files matching the "*.log" pattern
there and--should this succeed--replace the original pattern string
with one or more *distinct* arguments--the results of the expansion.

Say, if there were files 1.log, 2.log and 3.log under the "log"
directory at the time of the call, the `git rm` command would receive
three distinct arguments: "log/1.log", "log/2.log" and "log/3.log".

(If the expansion would fail--that is, no matching entities would have
been found, the shell would pass the source pattern "as is" to the
command it would call.)

On Windows, shells do not do pathname expansion; they don't even do
basic grouping of characters, and a Windows process, when it starts,
receives either one command line argument -- with all the stuff
specified on its command line being passed as is, or none at all (if
nothing was specified by the user).  It's then the process's own
responsibility to parse that stuff however it sees fit.  (The
programming language the program being called is written in typically
offers some help with this in its standard library.  Unfortunately,
differences in these implementations do exist even between different
versions of the standard C library between different releases of that
library.)

That was for the first part.  The second part is that certain Git
commands are able to expand globs (those "*" and "**" specs) in
pathnames by themselves.  To do this, you need to "protect" them from
expansion by the shell.  The backslash before the '*' character makes
the Unix-compatible shell turn the whole sequence "\*" into just '*'
while ignoring the special meaning of it.

Note that using "\*" on Windows supposes you're doing that in the Git
Bash shell -- which is a port of the (Unix-y) bash shell; the stock
Windows shells know nothing about the backslash quoting.

> [1] 
> https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.