This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: git and absolute Windows-style paths
- From: Ray Donnelly <mingw dot android at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Thu, 21 Apr 2016 14:11:05 +0100
- Subject: Re: git and absolute Windows-style paths
- Authentication-results: sourceware.org; auth=none
- 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> <57181360 dot 2090408 at cs dot umass dot edu>
Here's a patch for git 2.8.1 that I wrote for MSYS2 to address the
same issue. Because I'd read this thread before I started working on
it (and generally since it's good to) I kept it in mind to make it
work for Cygwin in-case you wanted to use it:
https://raw.githubusercontent.com/Alexpux/MSYS2-packages/6b7aceea4ad2e5bd28143a2de8c4a0d7453013dc/git/git-2.8.1-Cygwin-Allow-DOS-paths.patch
I'm running the test-suite now which takes an age, but I don't see any
problems with it so far. I didn't add any tests covering using DOS
paths though. I've tested it with git add and clone with DOS relative
and absolute paths.
Best regards,
Ray.
On Thu, Apr 21, 2016 at 12:40 AM, Eliot Moss <moss@cs.umass.edu> wrote:
> 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
>
--
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