Remove the use of '--' in merge program invocation

Put a "./" at the beginning of all paths given to the merge program so
that filenames beginning with a '-' character don't get interpreted as
options.

This deals with a problem where kdiff3 can be compiled with or without
support for the '--' separator between options and filenames.

Signed-off-by: Patrick Higgins <patrick.higgins@cexp.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Higgins 2008-06-16 17:33:41 -06:00 committed by Junio C Hamano
parent e449f10580
commit 641dba49bf

View File

@ -141,10 +141,10 @@ merge_file () {
fi fi
ext="$$$(expr "$MERGED" : '.*\(\.[^/]*\)$')" ext="$$$(expr "$MERGED" : '.*\(\.[^/]*\)$')"
BACKUP="$MERGED.BACKUP.$ext" BACKUP="./$MERGED.BACKUP.$ext"
LOCAL="$MERGED.LOCAL.$ext" LOCAL="./$MERGED.LOCAL.$ext"
REMOTE="$MERGED.REMOTE.$ext" REMOTE="./$MERGED.REMOTE.$ext"
BASE="$MERGED.BASE.$ext" BASE="./$MERGED.BASE.$ext"
mv -- "$MERGED" "$BACKUP" mv -- "$MERGED" "$BACKUP"
cp -- "$BACKUP" "$MERGED" cp -- "$BACKUP" "$MERGED"
@ -183,29 +183,29 @@ merge_file () {
kdiff3) kdiff3)
if base_present ; then if base_present ; then
("$merge_tool_path" --auto --L1 "$MERGED (Base)" --L2 "$MERGED (Local)" --L3 "$MERGED (Remote)" \ ("$merge_tool_path" --auto --L1 "$MERGED (Base)" --L2 "$MERGED (Local)" --L3 "$MERGED (Remote)" \
-o "$MERGED" -- "$BASE" "$LOCAL" "$REMOTE" > /dev/null 2>&1) -o "$MERGED" "$BASE" "$LOCAL" "$REMOTE" > /dev/null 2>&1)
else else
("$merge_tool_path" --auto --L1 "$MERGED (Local)" --L2 "$MERGED (Remote)" \ ("$merge_tool_path" --auto --L1 "$MERGED (Local)" --L2 "$MERGED (Remote)" \
-o "$MERGED" -- "$LOCAL" "$REMOTE" > /dev/null 2>&1) -o "$MERGED" "$LOCAL" "$REMOTE" > /dev/null 2>&1)
fi fi
status=$? status=$?
;; ;;
tkdiff) tkdiff)
if base_present ; then if base_present ; then
"$merge_tool_path" -a "$BASE" -o "$MERGED" -- "$LOCAL" "$REMOTE" "$merge_tool_path" -a "$BASE" -o "$MERGED" "$LOCAL" "$REMOTE"
else else
"$merge_tool_path" -o "$MERGED" -- "$LOCAL" "$REMOTE" "$merge_tool_path" -o "$MERGED" "$LOCAL" "$REMOTE"
fi fi
status=$? status=$?
;; ;;
meld|vimdiff) meld|vimdiff)
touch "$BACKUP" touch "$BACKUP"
"$merge_tool_path" -- "$LOCAL" "$MERGED" "$REMOTE" "$merge_tool_path" "$LOCAL" "$MERGED" "$REMOTE"
check_unchanged check_unchanged
;; ;;
gvimdiff) gvimdiff)
touch "$BACKUP" touch "$BACKUP"
"$merge_tool_path" -f -- "$LOCAL" "$MERGED" "$REMOTE" "$merge_tool_path" -f "$LOCAL" "$MERGED" "$REMOTE"
check_unchanged check_unchanged
;; ;;
xxdiff) xxdiff)
@ -215,13 +215,13 @@ merge_file () {
-R 'Accel.SaveAsMerged: "Ctrl-S"' \ -R 'Accel.SaveAsMerged: "Ctrl-S"' \
-R 'Accel.Search: "Ctrl+F"' \ -R 'Accel.Search: "Ctrl+F"' \
-R 'Accel.SearchForward: "Ctrl-G"' \ -R 'Accel.SearchForward: "Ctrl-G"' \
--merged-file "$MERGED" -- "$LOCAL" "$BASE" "$REMOTE" --merged-file "$MERGED" "$LOCAL" "$BASE" "$REMOTE"
else else
"$merge_tool_path" -X --show-merged-pane \ "$merge_tool_path" -X --show-merged-pane \
-R 'Accel.SaveAsMerged: "Ctrl-S"' \ -R 'Accel.SaveAsMerged: "Ctrl-S"' \
-R 'Accel.Search: "Ctrl+F"' \ -R 'Accel.Search: "Ctrl+F"' \
-R 'Accel.SearchForward: "Ctrl-G"' \ -R 'Accel.SearchForward: "Ctrl-G"' \
--merged-file "$MERGED" -- "$LOCAL" "$REMOTE" --merged-file "$MERGED" "$LOCAL" "$REMOTE"
fi fi
check_unchanged check_unchanged
;; ;;