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: Thu, 17 May 2012 19:30:15 +0100 [thread overview]
Message-ID: <4FB543B7.6000506@ramsay1.demon.co.uk> (raw)
In-Reply-To: <4FB340A9.60607@viscovery.net>
Johannes Sixt wrote:
> Am 5/15/2012 19:32, schrieb Ramsay Jones:
>> ++ 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'
> ...
>> So, the msys "path munging" of program arguments saves the day!
>
> Absolutely. This path munging is an essential detail in the process.
>
> I don't know whether Cygwin has a similar feature, but I suppose not,
> otherwise we wouldn't have received this issue report.
Yes, but I keep forgetting about this msys feature (I don't know why!).
I've had this "slap forehead" moment 3 or 4 times already (why do you
think I have the args program close to hand? :-D ).
As you surmised, cygwin does not have this feature. On cygwin you are
encouraged to use the cygpath utility in scripts. (Also, cygwin does
provide an API to convert to/from POSIX/win32 paths from your own
programs. eg. cygwin_conv_to_[full]_win32_path() and cygwin_conv_to_\
[full]_posix_path().)
>From the cygwin user guide, in a section titled "Using Cygwin effectively
with Windows", we find this:
"Windows programs do not understand POSIX pathnames, so any arguments
that reference the filesystem must be in Windows (or DOS) format or
translated. Cygwin provides the cygpath utility for converting
between Windows and POSIX paths. A complete description of its options
and examples of its usage are in Section 3.7.2, including a shell script
for starting Windows Explorer in any directory. The same format works
for most Windows programs, for example
notepad.exe "$(cygpath -aw "Desktop/Phone Numbers.txt")"
A few programs require a Windows-style, semicolon-delimited path list,
which cygpath can translate from a POSIX path with the -p option. For
example, a Java compilation from bash might look like this:
javac -cp "$(cygpath -pw "$CLASSPATH")" hello.java
Since using quoting and subshells is somewhat awkward, it is often
preferable to use cygpath in shell scripts."
Just as an exercise, I created a script to use the windows PSPad editor
(included below), using it to create a commit and also run this rebase:
GIT_EDITOR=pspad git rebase -i master uname
Both git commands launched the editor (and completed their task) just fine.
Note that the script can be improved greatly, but it only took ten minutes
to create and is sufficient to this task. (PSPad supports more than one file
on the command line, despite what it's help file says, although all options
apply to all files. You should be able to "bundle" the options ...).
ATB,
Ramsay Jones
-- >8 --
#!/bin/sh
file=
opts=
while test $# != 0
do
case "$1" in
-[hH])
# open file in hex editor
opts="$opts /H"
;;
-[rR])
# open file in read-only mode
opts="$opts /R"
;;
-[0-9]*)
# open file and goto line n
opts="$opts /${1:1}"
;;
-*)
echo "option '$1' not supported"
exit 1
;;
*)
if test -n "$file"; then
echo "only one filename allowed"
exit 1
fi
file="$1"
;;
esac
shift
done
if test -n "$file"; then
file="$(cygpath -aw "$file")"
fi
"C:/Program Files/PSPad editor/PSPad.exe" "$file" $opts
-- 8< --
next prev parent reply other threads:[~2012-05-17 18:30 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
2012-05-16 5:52 ` Johannes Sixt
2012-05-17 18:30 ` Ramsay Jones [this message]
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=4FB543B7.6000506@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).