From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7788 invoked by alias); 20 Apr 2016 23:40:26 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 7775 invoked by uid 89); 20 Apr 2016 23:40:26 -0000 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 Received: from mdc1.cs.umass.edu (HELO csmail.cs.umass.edu) (128.119.240.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 20 Apr 2016 23:40:25 +0000 Received: from [192.168.0.19] (c-24-62-203-86.hsd1.ma.comcast.net [24.62.203.86]) by csmail.cs.umass.edu (Postfix) with ESMTPSA id 34C7768000174973B7; Wed, 20 Apr 2016 19:40:23 -0400 (EDT) Reply-To: moss@cs.umass.edu Subject: Re: git and absolute Windows-style paths References: <57169662.9060503@gmail.com> <5717A3EF.6030407@gmail.com> <5717A5C6.5060001@cs.umass.edu> <5717E88E.5050404@cs.umass.edu> <57180D5A.8020300@raelity.com> To: cygwin@cygwin.com From: Eliot Moss Message-ID: <57181360.2090408@cs.umass.edu> Date: Thu, 21 Apr 2016 00:14:00 -0000 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> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg00541.txt.bz2 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