delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/04/20/17:05:57

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:date:from:to:subject:message-id:references
:mime-version:content-type:in-reply-to; q=dns; s=default; b=ZaPp
CMlpWB0eXthyJ1XCw/RMUlfjNWJv/tsSjfV0cXen7gXSg9O7gamqMIMrFFeW6Sxy
C8tqH38Xa08whgxL5V/L+SbLfQcGayrZUoBSFmrwf8PuQfjWZvhQYFOFrrFRGz2N
GTrTv5iwN30gPNPBE/kBikesAp6n7z6p+sSdjDQ=
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:date:from:to:subject:message-id:references
:mime-version:content-type:in-reply-to; s=default; bh=UKvqW2YVkV
Orkrwg8pC5xWi1zyg=; b=pkYe3WL69mp2W0Yz1n8SMtBlnXIRfKj/pnjuex8e1w
M0CW7dwWFnBSuFshxv5r1qMdqX+j8dYHwP2r3q969gUz1YjA5wOoonxkDVt4ZrB9
JPHE4FFU1l8PWVS+h+pu4LM8Dfn0Xu33jlMkw/sd1BN+ddqBTLBDd60j2oSBkeZF
I=
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=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:804, H*f:sk:5717E88, H*MI:sk:5717E88, H*i:sk:5717E88
X-HELO: mail-wm0-f53.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=GZH9h1QJqlK5EVATeuCf6gxM5VEK1JcNIDnimnL6GZw=; b=mXjXvLYCvTIrFSIg9MflHKiAXJESAa827OQ/QBrS6CTZCwW4G5yiCH2s6HS0+aVNVq Zq2zJdXlG28F/E/X7b+DAVlu4/en1qKd+9MwsQZ3+K5/XWkuZBgo5jGV8H0u9zrxYIzL PvfPpXOQh+i10PnC2LG5K9rSFBWZA4d/JyhUaJj42KrFobkjI/xKPaMiHuCmMY99lINY xKcJKUiYFUvM8sVobqZszIs1zuUHPxiOQfV99oajoeVZZnbb8K9VgBguMrjLJ8PEvJzR B/bmtEZjE9oJ0JAjLnddByGTvAq8izTEKgMKEBT0WQCCyfPJCZzC2E6mYAcjcewNeQxX LLPQ==
X-Gm-Message-State: AOPr4FVbS7kqqtYjDxmnwjSRhPmp53BodSPhYC6tAgYFlHuXVGfGhKGKR6cOnSvY9RcIFw==
X-Received: by 10.194.116.103 with SMTP id jv7mr11408403wjb.22.1461186329103; Wed, 20 Apr 2016 14:05:29 -0700 (PDT)
Date: Wed, 20 Apr 2016 22:05:26 +0100
From: Adam Dinwoodie <adam AT dinwoodie DOT org>
To: cygwin AT cygwin DOT com
Subject: Re: git and absolute Windows-style paths
Message-ID: <20160420210526.GL2345@dinwoodie.org>
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>
MIME-Version: 1.0
In-Reply-To: <5717E88E.5050404@cs.umass.edu>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-IsSubscribed: yes

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.

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019