X-Recipient: archive-cygwin@delorie.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@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.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@dinwoodie.org>
To: cygwin@cygwin.com
Subject: Re: git and absolute Windows-style paths
Message-ID: <20160420210526.GL2345@dinwoodie.org>
References: <57169662.9060503@gmail.com> <e8b47924c6ff4f07993627dbb26f7066@ntmaexbe04.bedford.progress.com> <5717A3EF.6030407@gmail.com> <5717A5C6.5060001@cs.umass.edu> <BLUPR03MB23017F9B3FCB1DEDA3F7734DF6D0@BLUPR03MB230.namprd03.prod.outlook.com> <5717E88E.5050404@cs.umass.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
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

