X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-mergetool.sh;h=9f4f3134b60174495c23968cf1ca01ffdbc49bdf;hb=785586142a5ed083b97b7be472c08982ae88fd8f;hp=7b663091935fd83e5985e5d8b9763cafecc0947d;hpb=96c48153c9a2905fb2f1d588c11e36272635cb79;p=git.git diff --git a/git-mergetool.sh b/git-mergetool.sh index 7b6630919..9f4f3134b 100755 --- a/git-mergetool.sh +++ b/git-mergetool.sh @@ -12,6 +12,7 @@ USAGE='[--tool=tool] [file to merge] ...' SUBDIRECTORY_OK=Yes . git-sh-setup require_work_tree +prefix=$(git rev-parse --show-prefix) # Returns true if the mode reflects a symlink is_symlink () { @@ -65,14 +66,14 @@ resolve_symlink_merge () { read ans case "$ans" in [lL]*) - git-checkout-index -f --stage=2 -- "$path" - git-add -- "$path" + git checkout-index -f --stage=2 -- "$path" + git add -- "$path" cleanup_temp_files --save-backup return ;; [rR]*) - git-checkout-index -f --stage=3 -- "$path" - git-add -- "$path" + git checkout-index -f --stage=3 -- "$path" + git add -- "$path" cleanup_temp_files --save-backup return ;; @@ -93,12 +94,12 @@ resolve_deleted_merge () { read ans case "$ans" in [mMcC]*) - git-add -- "$path" + git add -- "$path" cleanup_temp_files --save-backup return ;; [dD]*) - git-rm -- "$path" > /dev/null + git rm -- "$path" > /dev/null cleanup_temp_files return ;; @@ -140,7 +141,7 @@ remove_backup () { merge_file () { path="$1" - f=`git-ls-files -u -- "$path"` + f=`git ls-files -u -- "$path"` if test -z "$f" ; then if test ! -f "$path" ; then echo "$path: file not found" @@ -162,9 +163,9 @@ merge_file () { local_mode=`git ls-files -u -- "$path" | awk '{if ($3==2) print $1;}'` remote_mode=`git ls-files -u -- "$path" | awk '{if ($3==3) print $1;}'` - base_present && git cat-file blob ":1:$path" > "$BASE" 2>/dev/null - local_present && git cat-file blob ":2:$path" > "$LOCAL" 2>/dev/null - remote_present && git cat-file blob ":3:$path" > "$REMOTE" 2>/dev/null + base_present && git cat-file blob ":1:$prefix$path" >"$BASE" 2>/dev/null + local_present && git cat-file blob ":2:$prefix$path" >"$LOCAL" 2>/dev/null + remote_present && git cat-file blob ":3:$prefix$path" >"$REMOTE" 2>/dev/null if test -z "$local_mode" -o -z "$remote_mode"; then echo "Deleted merge conflict for '$path':" @@ -191,10 +192,10 @@ merge_file () { case "$merge_tool" in kdiff3) if base_present ; then - (kdiff3 --auto --L1 "$path (Base)" -L2 "$path (Local)" --L3 "$path (Remote)" \ + (kdiff3 --auto --L1 "$path (Base)" --L2 "$path (Local)" --L3 "$path (Remote)" \ -o "$path" -- "$BASE" "$LOCAL" "$REMOTE" > /dev/null 2>&1) else - (kdiff3 --auto -L1 "$path (Local)" --L2 "$path (Remote)" \ + (kdiff3 --auto --L1 "$path (Local)" --L2 "$path (Remote)" \ -o "$path" -- "$LOCAL" "$REMOTE" > /dev/null 2>&1) fi status=$? @@ -251,9 +252,9 @@ merge_file () { ;; emerge) if base_present ; then - emacs -f emerge-files-with-ancestor-command "$LOCAL" "$REMOTE" "$BASE" "$path" + emacs -f emerge-files-with-ancestor-command "$LOCAL" "$REMOTE" "$BASE" "$(basename "$path")" else - emacs -f emerge-files-command "$LOCAL" "$REMOTE" "$path" + emacs -f emerge-files-command "$LOCAL" "$REMOTE" "$(basename "$path")" fi status=$? save_backup @@ -268,7 +269,7 @@ merge_file () { cleanup_temp_files } -while case $# in 0) break ;; esac +while test $# != 0 do case "$1" in -t|--tool*) @@ -297,7 +298,7 @@ do done if test -z "$merge_tool"; then - merge_tool=`git-config merge.tool` + merge_tool=`git config merge.tool` case "$merge_tool" in kdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | gvimdiff | "") ;; # happy