From: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: Steven Penny <svnpenn@gmail.com>,
Junio C Hamano <gitster@pobox.com>,
git@vger.kernel.org
Subject: Re: Git commit path vs rebase path
Date: Tue, 15 May 2012 18:32:10 +0100 [thread overview]
Message-ID: <4FB2931A.1080504@ramsay1.demon.co.uk> (raw)
In-Reply-To: <4FB09FF2.70309@viscovery.net>
Johannes Sixt wrote:
> Am 5/14/2012 0:58, schrieb Ramsay Jones:
>> BTW, Johannes, earlier you said commit be39048 ("git-sh-setup.sh: Add an pwd()
>> function for MinGW", 17-04-2012) would fix the problem on MinGW; I'm not so
>> sure it will.
>
>> [...] problem (*which MinGW shares*) is that the
>> pwd() function is defined *after* the code that sets $GIT_DIR from which the
>> rebase state directory name is derived (see git-sh-setup.sh lines 223-239).
>
> Good catch!
>
> Nevertheless, if I set GIT_EDITOR to "notepad", 'git rebase -i' works to
> some degree. Leaving aside that it does not understand LF line endings, it
> opens the git-rebase-todo file; I can edit and save it. That is, it looks
> like a usable Windows style path was passed to Notepad. (This is with
> MinGW git, of course.)
>
I was about to, confidently, proclaim that it should fail when
you run that rebase from a subdirectory ... Unfortunately, it
seems to work! *ahem*
The reason I was confident, is simply that I have seen this
pattern:
p= ...some path...
p=$(cd "$p" && pwd)
many times while debugging scripts on MinGW, so I 'know' that if
p is initially a relative path, then the result is an absolute
windows path. For example, while cwd is /home/ramsay/git then:
.git => C:/msysgit/msysgit/home/ramsay/git/.git
Whereas if p is initially an absolute windows path, then the result
is a POSIX-like path, viz:
C:/msysgit/msysgit/home/ramsay/git/.git => /usr/home/ramsay/git/.git
If you combine that with the behaviour of 'git rev-parse', thus:
$ cd /home/ramsay/git
$ git rev-parse --git-dir
.git
$ cd xdiff
$ git rev-parse --git-dir
C:/msysgit/msysgit/home/ramsay/git/.git
$
you should see "git rebase -i" invoking the editor with a POSIX
path.
[BTW, I have noticed that I sometimes get different behaviour when
I type this stuff into an interactive shell. :(]
Anyway, a bit of debugging shows that I was right, kinda! :-D
I placed a "set -x" in git-sh-setup (line 222) just before the code
to set up GIT_DIR and ran git-rebase like so:
$ cd /home/ramsay/git
$ GIT_EDITOR=false ./bin-wrappers/git rebase -i master uname >ttt 2>&1
$ cd xdiff
$ GIT_EDITOR=false ../bin-wrappers/git rebase -i master uname >sss 2>&1
$ diff ../ttt sss | more
which showed that in the subdirectory case, git was indeed invoking
the editor with a POSIX-like path. (The output files, ttt and sss, show
some other interesting/odd behaviour).
['uname' is an old branch of mine that, currently, is based on v1.7.10]
The reason it works, despite the above, is clear if you now run:
$ GIT_EDITOR=args ../bin-wrappers/git rebase -i master uname
...
+++ git var GIT_EDITOR
++ GIT_SEQUENCE_EDITOR=args
++ eval args '"$@"'
+++ args /usr/home/ramsay/git/.git/rebase-merge/git-rebase-todo
argv[0] = 'C:\msysgit\msysgit\home\ramsay\bin\args.exe'
argv[1] = 'C:/msysgit/msysgit/home/ramsay/git/.git/rebase-merge/git-rebase-todo'
++ die_abort 'Could not execute editor'
++ rm -rf /usr/home/ramsay/git/.git/rebase-merge
++ die 'Could not execute editor'
++ die_with_status 1 'Could not execute editor'
++ status=1
++ shift
++ echo 'Could not execute editor'
Could not execute editor
++ exit 1
[I'm sure you can guess what the args program looks like!]
So, the msys "path munging" of program arguments saves the day!
HTH
ATB,
Ramsay Jones
next prev parent reply other threads:[~2012-05-15 17:32 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-06 4:24 Git commit path vs rebase path Steven Penny
2012-05-07 17:27 ` Junio C Hamano
2012-05-08 6:22 ` Johannes Sixt
2012-05-08 6:44 ` Steven Penny
2012-05-08 7:06 ` Johannes Sixt
2012-05-08 7:11 ` Steven Penny
2012-05-08 17:02 ` Junio C Hamano
2012-05-08 17:25 ` Junio C Hamano
2012-05-08 22:47 ` Steven Penny
2012-05-09 21:54 ` Junio C Hamano
2012-05-09 23:14 ` Steven Penny
2012-05-10 18:10 ` Ramsay Jones
2012-05-11 4:35 ` Steven Penny
2012-05-13 22:58 ` Ramsay Jones
2012-05-13 23:42 ` Steven Penny
2012-05-14 6:02 ` Johannes Sixt
2012-05-15 17:32 ` Ramsay Jones [this message]
2012-05-16 5:52 ` Johannes Sixt
2012-05-17 18:30 ` Ramsay Jones
2012-05-17 19:19 ` Junio C Hamano
2012-05-16 18:00 ` [PATCH 0/2] " Junio C Hamano
2012-05-16 18:00 ` [PATCH 1/2] git-sh-setup: define workaround wrappers before they are used Junio C Hamano
2012-05-17 22:36 ` Ramsay Jones
2012-05-16 18:00 ` [PATCH 2/2] git-sh-setup: work around Cygwin path handling gotchas Junio C Hamano
2012-05-16 18:51 ` Steven Penny
2012-05-16 19:02 ` Junio C Hamano
2012-05-17 23:15 ` Ramsay Jones
2012-05-18 2:34 ` Junio C Hamano
2012-05-19 0:43 ` Steven Penny
2012-05-21 18:43 ` Ramsay Jones
2012-05-21 22:24 ` Junio C Hamano
2012-05-24 18:27 ` Ramsay Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FB2931A.1080504@ramsay1.demon.co.uk \
--to=ramsay@ramsay1.demon.co.uk \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j.sixt@viscovery.net \
--cc=svnpenn@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.