@@ -12,6 +12,7 @@ USAGE='[--tool=tool] [file to merge] ...'
1212SUBDIRECTORY_OK=Yes
1313. git-sh-setup
1414require_work_tree
15+ prefix=$( git rev-parse --show-prefix)
1516
1617# Returns true if the mode reflects a symlink
1718is_symlink () {
@@ -162,9 +163,9 @@ merge_file () {
162163 local_mode=` git ls-files -u -- " $path " | awk ' {if ($3==2) print $1;}' `
163164 remote_mode=` git ls-files -u -- " $path " | awk ' {if ($3==3) print $1;}' `
164165
165- base_present && git cat-file blob " :1:$path " > " $BASE " 2> /dev/null
166- local_present && git cat-file blob " :2:$path " > " $LOCAL " 2> /dev/null
167- remote_present && git cat-file blob " :3:$path " > " $REMOTE " 2> /dev/null
166+ base_present && git cat-file blob " :1:$prefix$ path " > " $BASE " 2> /dev/null
167+ local_present && git cat-file blob " :2:$prefix$ path " > " $LOCAL " 2> /dev/null
168+ remote_present && git cat-file blob " :3:$prefix$ path " > " $REMOTE " 2> /dev/null
168169
169170 if test -z " $local_mode " -o -z " $remote_mode " ; then
170171 echo " Deleted merge conflict for '$path ':"
@@ -191,10 +192,10 @@ merge_file () {
191192 case " $merge_tool " in
192193 kdiff3)
193194 if base_present ; then
194- (kdiff3 --auto --L1 " $path (Base)" -L2 " $path (Local)" --L3 " $path (Remote)" \
195+ (kdiff3 --auto --L1 " $path (Base)" -- L2 " $path (Local)" --L3 " $path (Remote)" \
195196 -o " $path " -- " $BASE " " $LOCAL " " $REMOTE " > /dev/null 2>&1 )
196197 else
197- (kdiff3 --auto -L1 " $path (Local)" --L2 " $path (Remote)" \
198+ (kdiff3 --auto -- L1 " $path (Local)" --L2 " $path (Remote)" \
198199 -o " $path " -- " $LOCAL " " $REMOTE " > /dev/null 2>&1 )
199200 fi
200201 status=$?
@@ -251,9 +252,9 @@ merge_file () {
251252 ;;
252253 emerge)
253254 if base_present ; then
254- emacs -f emerge-files-with-ancestor-command " $LOCAL " " $REMOTE " " $BASE " " $path "
255+ emacs -f emerge-files-with-ancestor-command " $LOCAL " " $REMOTE " " $BASE " " $( basename " $ path" ) "
255256 else
256- emacs -f emerge-files-command " $LOCAL " " $REMOTE " " $path "
257+ emacs -f emerge-files-command " $LOCAL " " $REMOTE " " $( basename " $ path" ) "
257258 fi
258259 status=$?
259260 save_backup
0 commit comments