From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24628 invoked by alias); 20 Apr 2016 21:05:43 -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 24602 invoked by uid 89); 20 Apr 2016 21:05:42 -0000 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 Received: from mail-wm0-f53.google.com (HELO mail-wm0-f53.google.com) (74.125.82.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 20 Apr 2016 21:05:32 +0000 Received: by mail-wm0-f53.google.com with SMTP id u206so101436153wme.1 for ; Wed, 20 Apr 2016 14:05:31 -0700 (PDT) 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) Received: from dinwoodie.org ([2001:ba8:0:1c0::9:1]) by smtp.gmail.com with ESMTPSA id gt7sm7465703wjc.1.2016.04.20.14.05.28 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 20 Apr 2016 14:05:28 -0700 (PDT) Date: Wed, 20 Apr 2016 21:17:00 -0000 From: Adam Dinwoodie To: cygwin@cygwin.com Subject: Re: git and absolute Windows-style paths Message-ID: <20160420210526.GL2345@dinwoodie.org> References: <57169662.9060503@gmail.com> <5717A3EF.6030407@gmail.com> <5717A5C6.5060001@cs.umass.edu> <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 X-SW-Source: 2016-04/txt/msg00536.txt.bz2 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