This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: git and absolute Windows-style paths


Greetings, Adam Dinwoodie!

> On Wed, Apr 20, 2016 at 04:37:34PM -0400, Eliot Moss wrote:
>> I think this will do it:
>> 
>> function git {
>>   declare -a ARGS
>>   for n in "$@" ; do ARGS+=("$(cygpath -u -- "${n}")") ; done
>>   command git "${ARGS[@]}"
>> }
>> 
>> The reason this is a little more complicated than some other approaches
>> might be is that it will also work for arguments that have space, e.g.,
>> 
>> git add "C:/My Documents/foo.doc"

> For a marginally simpler, or at least shorter, version, use `for n; do
> ...` rather than `for n in "$@"; do` -- Bash loops over positional
> arguments by default if you don't specify a list with `in`.

> Perfect for confusing anyone else (or indeed yourself at some point in
> the future) who isn't familiar with the many, many idiosyncrasies of
> shell languages.

There's no chance you could confuse anyone with this functionality, as it is
mandated by POSIX.


-- 
With best regards,
Andrey Repin
Thursday, April 21, 2016 19:33:42

Sorry for my terrible english...


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]