| delorie.com/archives/browse.cgi | search | 
| X-Recipient: | archive-cygwin AT delorie DOT com | 
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id | 
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:reply-to:subject:references:to:from:message-id | |
| :date:mime-version:in-reply-to:content-type | |
| :content-transfer-encoding; q=dns; s=default; b=oeO5FJv19SWEpimN | |
| 1qLaVoOsSYs8+GJ0+HCN40VO3Od0rbX4sMNIMXqJp+36zipjOF+MXxTazuuA1FkV | |
| CaiRiJhXoSfVePb1PrmSZhRMpBgLkkIRsSMtE/5fLIEB78MUykP1X7Rr6fW8FhFA | |
| GWSDfQd0leVMsie28pc6ynNjo0w= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id | 
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:reply-to:subject:references:to:from:message-id | |
| :date:mime-version:in-reply-to:content-type | |
| :content-transfer-encoding; s=default; bh=3xKVDKAqT7bv2dYWy2ej0R | |
| bvhvU=; b=Km/lp+FG8Bj7BzdCI2tE6MQIhR7VbZ2VYAzXFHd7L2DHXLy0JMwaqr | |
| Xx1SJtK1pJQ0d6DEKjZVF3cDa0ACgEa9Ht9hzsJyJ3QIkODsx4Ie7iIeKP3VUFqU | |
| +QliTDRaGTIf01kQBQrY72OmD1YuD/+ew0BeZzLcyF6n1wYhIo5ws= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm | 
| List-Id: | <cygwin.cygwin.com> | 
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> | 
| List-Archive: | <http://sourceware.org/ml/cygwin/> | 
| List-Post: | <mailto:cygwin AT cygwin DOT com> | 
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> | 
| Sender: | cygwin-owner AT cygwin DOT com | 
| Mail-Followup-To: | cygwin AT cygwin DOT com | 
| Delivered-To: | mailing list cygwin AT cygwin DOT com | 
| Authentication-Results: | sourceware.org; auth=none | 
| X-Virus-Found: | No | 
| X-Spam-SWARE-Status: | No, score=-0.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Ernie, rael, Rael, Hx-languages-length:754 | 
| X-HELO: | csmail.cs.umass.edu | 
| Reply-To: | moss AT cs DOT umass DOT edu | 
| Subject: | Re: git and absolute Windows-style paths | 
| References: | <57169662 DOT 9060503 AT gmail DOT com> <e8b47924c6ff4f07993627dbb26f7066 AT ntmaexbe04 DOT bedford DOT progress DOT com> <5717A3EF DOT 6030407 AT gmail DOT com> <5717A5C6 DOT 5060001 AT cs DOT umass DOT edu> <BLUPR03MB23017F9B3FCB1DEDA3F7734DF6D0 AT BLUPR03MB230 DOT namprd03 DOT prod DOT outlook DOT com> <5717E88E DOT 5050404 AT cs DOT umass DOT edu> <57180D5A DOT 8020300 AT raelity DOT com> | 
| To: | cygwin AT cygwin DOT com | 
| From: | Eliot Moss <moss AT cs DOT umass DOT edu> | 
| Message-ID: | <57181360.2090408@cs.umass.edu> | 
| Date: | Wed, 20 Apr 2016 19:40:16 -0400 | 
| User-Agent: | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 | 
| MIME-Version: | 1.0 | 
| In-Reply-To: | <57180D5A.8020300@raelity.com> | 
| X-IsSubscribed: | yes | 
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
| webmaster | delorie software privacy | 
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |