Re: [PATCH] Add git-mergetool to run an appropriate merge conflict resolution program

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I had a chance to use git-mergetool in real life for the first
time today, when I merged 'maint' into 'master'.  It has a
symlink vs symlink conflict, so I got something like this:

================================================================
Merging the files: RelNotes

Symlink merge conflict for RelNotes:
    'RelNotes' is a symlink containing 'Documentation/RelNotes-1.5.1.txt' in the local branch
    'RelNotes' is a symlink containing 'Documentation/RelNotes-1.5.0.6.txt' in the remote branch
Use (r)emote or (l)ocal, or (a)bort?
================================================================

A few observations.

(1) Saying "a" <Return> does not let me exit.  It keeps asking
    the same question.

(2) The word "symlink" might be less geekish if worded "symbolic
    link".

(3) The message look very long, and repeats the same information.

(4) The status info gives local and then remote, but the choice
    is between remote and local.

The attached is a minimum fix for the above issues, but not for
immediate application, as I am sure the rewording would make
messages inconsistent with other cases.  The updated output
would look like this:

================================================================
Merging the files: RelNotes

Symbolic link merge conflict for 'RelNotes':
  local: a symbolic link -> 'Documentation/RelNotes-1.5.1.txt'
  remote: a symbolic link -> 'Documentation/RelNotes-1.5.0.6.txt'
Use (l)ocal or (r)emote, or (a)bort? l
================================================================

---
 git-mergetool.sh |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/git-mergetool.sh b/git-mergetool.sh
index 7942fd0..0b30133 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -44,27 +44,24 @@ function describe_file () {
     branch="$2"
     file="$3"
 
-    echo -n "    "
+    echo -n "  ${branch}: "
     if test -z "$mode"; then
-	echo -n "'$path' was deleted"
+	echo "deleted"
     elif is_symlink "$mode" ; then
-	echo -n "'$path' is a symlink containing '"
-	cat "$file"
-	echo -n "'"
+	echo "a symbolic link -> '$(cat "$file")'"
     else
 	if base_present; then
-	    echo -n "'$path' was created"
+	    echo "created"
 	else
-	    echo -n "'$path' was modified"
+	    echo "modified"
 	fi
     fi
-    echo " in the $branch branch"
 }
 
 
 resolve_symlink_merge () {
     while /bin/true; do
-	echo -n "Use (r)emote or (l)ocal, or (a)bort? "
+	echo -n "Use (l)ocal or (r)emote, or (a)bort? "
 	read ans
 	case "$ans" in
 	    [lL]*)
@@ -79,7 +76,7 @@ resolve_symlink_merge () {
 		cleanup_temp_files --save-backup
 		return
 		;;
-	    [qQ]*)
+	    [aAqQ]*)
 		exit 1
 		;;
 	    esac
@@ -147,7 +144,7 @@ merge_file () {
     fi
 
     if is_symlink "$local_mode" || is_symlink "$remote_mode"; then
-	echo "Symlink merge conflict for $path:"
+	echo "Symbolic link conflict for '$path':"
 	describe_file "$local_mode" "local" "$LOCAL"
 	describe_file "$remote_mode" "remote" "$REMOTE"
 	resolve_symlink_merge

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]