git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <junkio@cox.net>
Date
Mar 29, 2007, 03:58 UTC
Message-ID
<7vabxwbszq.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<E1HORtY-0000zK-8B@candygram.thunk.org>

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
Previous: Junio C HamanoNext: Theodore Tso
Message 6 of 7 in “Add git-mergetool to run an appropriate merge conflict resolution program”
  1. Add git-mergetool to run an appropriate merge conflict resolution programTheodore Ts'o, Mar 6, 2007
  2. Junio C HamanoMar 6, 2007
  3. Theodore TsoMar 6, 2007
  4. Linus TorvaldsMar 6, 2007
  5. Junio C HamanoMar 6, 2007
  6. Junio C HamanoMar 29, 2007
  7. Theodore TsoMar 29, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.