public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eliot Moss <moss@cs.umass.edu>
To: cygwin@cygwin.com
Subject: Re: git and absolute Windows-style paths
Date: Thu, 21 Apr 2016 00:14:00 -0000	[thread overview]
Message-ID: <57181360.2090408@cs.umass.edu> (raw)
In-Reply-To: <57180D5A.8020300@raelity.com>

On 4/20/2016 7:14 PM, Ernie Rael wrote:
> On 4/20/2016 1:37 PM, 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"
>
> Notice that
>     IFS=$'\n'; args=($(cygpath -m -- "$@")); IFS=$' \t\n'
> also handles arguments with spaces. You don't need the shell for loop.

Ok ... but I would save the previous value of IFS and restore it -- never
know what a user might be using there ...

Best -- E

--
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

  reply	other threads:[~2016-04-20 23:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19 21:00 silverwind
2016-04-19 21:58 ` Marco Atzeri
2016-04-19 22:28   ` Ken Brown
2016-04-20 10:28     ` Adam Dinwoodie
2016-04-20  0:49 ` Bill Smith
2016-04-20 15:52   ` silverwind
2016-04-20 16:06     ` Eliot Moss
2016-04-20 16:15       ` Brian Clifton
2016-04-20 18:18         ` Ernie Rael
2016-04-20 20:39         ` Eliot Moss
2016-04-20 21:17           ` Adam Dinwoodie
2016-04-21 19:50             ` Andrey Repin
2016-04-20 23:40           ` Ernie Rael
2016-04-21  0:14             ` Eliot Moss [this message]
2016-04-21 15:19               ` Ray Donnelly
2016-04-21 16:01                 ` Ray Donnelly
2016-04-20 16:46       ` silverwind
2016-04-20 16:56         ` Adam Dinwoodie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57181360.2090408@cs.umass.edu \
    --to=moss@cs.umass.edu \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).