Johannes Sixt wrote:
Am 5/15/2012 19:32, schrieb Ramsay Jones:
quoted
++ 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'
...
quoted
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< --