* [PATCH] Add git-mergetool to run an appropriate merge conflict resolution program
@ 2007-03-06 5:07 Theodore Ts'o
2007-03-06 5:43 ` Junio C Hamano
2007-03-29 3:58 ` Junio C Hamano
0 siblings, 2 replies; 7+ messages in thread
From: Theodore Ts'o @ 2007-03-06 5:07 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
The git-mergetool program can be used to automatically run an appropriate
merge resolution program to resolve merge conflicts. It will automatically
run one of kdiff3, tkdiff, meld, xxdiff, or emacs emerge programs.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
.gitignore | 1 +
Documentation/config.txt | 5 +
Documentation/git-mergetool.txt | 46 +++++++++
Makefile | 2 +-
git-mergetool.sh | 208 +++++++++++++++++++++++++++++++++++++++
5 files changed, 261 insertions(+), 1 deletions(-)
create mode 100644 Documentation/git-mergetool.txt
create mode 100755 git-mergetool.sh
diff --git a/.gitignore b/.gitignore
index 0eaba0a..27797d1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -75,6 +75,7 @@ git-merge-ours
git-merge-recursive
git-merge-resolve
git-merge-stupid
+git-mergetool
git-mktag
git-mktree
git-name-rev
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 5408dd6..0a72e41 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -453,6 +453,11 @@ merge.summary::
Whether to include summaries of merged commits in newly created
merge commit messages. False by default.
+merge.tool::
+ Controls which merge resolution program is used by
+ gitlink:git-mergetool[l]. Valid values are: "kdiff3", "tkdiff",
+ "meld", "xxdiff", "emerge"
+
merge.verbosity::
Controls the amount of output shown by the recursive merge
strategy. Level 0 outputs nothing except a final error
diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt
new file mode 100644
index 0000000..8cc00fb
--- /dev/null
+++ b/Documentation/git-mergetool.txt
@@ -0,0 +1,46 @@
+git-mergetool(1)
+================
+
+NAME
+----
+git-mergetool - Forward-port local commits to the updated upstream head
+
+SYNOPSIS
+--------
+'git-mergetool' [--tool=<tool>] [<file>]...
+
+DESCRIPTION
+-----------
+
+Use 'git mergetool' to run one of several merge utilities to resolve
+merge conflicts. It is typically run after gitlink:git-merge[1].
+
+If one or more <file> parameters are given, the merge tool program will
+be run to resolve differences on each file. If no <file> names are
+specified, 'git mergetool' will run the merge tool program on every file
+with merge conflicts.
+
+OPTIONS
+-------
+-t or --tool=<tool>::
+ Use the merge resolution program specified by <tool>.
+ Valid merge tools are:
+ kdiff3, tkdiff, meld, xxdiff, and emerge.
+
+ If a merge resolution program is not specified, 'git mergetool'
+ will use the configuration variable merge.tool. If the
+ configuration variable merge.tool is not set, 'git mergetool'
+ will pick a suitable default.
+
+Author
+------
+Written by Theodore Y Ts'o <tytso@mit.edu>
+
+Documentation
+--------------
+Documentation by Theodore Y Ts'o.
+
+GIT
+---
+Part of the gitlink:git[7] suite
+
diff --git a/Makefile b/Makefile
index a221bdc..502f660 100644
--- a/Makefile
+++ b/Makefile
@@ -177,7 +177,7 @@ SCRIPT_SH = \
git-clean.sh git-clone.sh git-commit.sh \
git-fetch.sh git-gc.sh \
git-ls-remote.sh \
- git-merge-one-file.sh git-parse-remote.sh \
+ git-merge-one-file.sh git-mergetool.sh git-parse-remote.sh \
git-pull.sh git-rebase.sh \
git-repack.sh git-request-pull.sh git-reset.sh \
git-revert.sh git-sh-setup.sh \
diff --git a/git-mergetool.sh b/git-mergetool.sh
new file mode 100755
index 0000000..b961719
--- /dev/null
+++ b/git-mergetool.sh
@@ -0,0 +1,208 @@
+#!/bin/sh
+#
+# This program resolves merge conflicts in git
+#
+# Copyright (c) 2006 Theodore Y. Ts'o
+#
+# This file is licensed under the GPL v2, or a later version
+# at the discretion of Linus Torvalds.
+#
+
+usage () {
+ echo "Usage: git mergetool [--tool=tool] [file to merge] ..."
+ exit 1
+}
+
+merge_file () {
+ path="$1"
+
+ if test ! -f "$path" ; then
+ echo "$path: file not found"
+ exit 1
+ fi
+
+ f=`git-ls-files -u "$path"`
+ if test -z "$f" ; then
+ echo "$path: file does not need merging"
+ exit 1
+ fi
+
+ BACKUP="$path.BACKUP.$$"
+ LOCAL="$path.LOCAL.$$"
+ REMOTE="$path.REMOTE.$$"
+ BASE="$path.BASE.$$"
+
+ mv "$path" "$BACKUP"
+ cp "$BACKUP" "$path"
+
+ git cat-file blob ":1:$path" > "$BASE"
+ git cat-file blob ":2:$path" > "$LOCAL"
+ git cat-file blob ":3:$path" > "$REMOTE"
+
+ case "$merge_tool" in
+ kdiff3)
+ (kdiff3 --auto --L1 "$path (Base)" -L2 "$path (Local)" --L3 "$path (Remote)" \
+ "$BASE" "$LOCAL" "$REMOTE" -o "$path" > /dev/null 2>&1)
+ status=$?
+ if test "$status" -eq 0; then
+ rm "$BACKUP"
+ fi
+ ;;
+ tkdiff)
+ tkdiff "$LOCAL" "$REMOTE" -a "$BASE" -o "$path"
+ status=$?
+ if test "$status" -eq 0; then
+ mv "$BACKUP" "$path.orig"
+ fi
+ ;;
+ meld)
+ touch "$BACKUP"
+ meld "$LOCAL" "$path" "$REMOTE"
+ if test "$path" -nt "$BACKUP" ; then
+ status=0;
+ else
+ while true; do
+ echo "$path seems unchanged."
+ echo -n "Was the merge successful? [y/n] "
+ read answer < /dev/tty
+ case "$answer" in
+ y*|Y*) status=0; break ;;
+ n*|N*) status=1; break ;;
+ esac
+ done
+ fi
+ if test "$status" -eq 0; then
+ mv "$BACKUP" "$path.orig"
+ fi
+ ;;
+ xxdiff)
+ touch "$BACKUP"
+ xxdiff -X --show-merged-pane \
+ -R 'Accel.SaveAsMerged: "Ctrl-S"' \
+ -R 'Accel.Search: "Ctrl+F"' \
+ -R 'Accel.SearchForward: "Ctrl-G"' \
+ --merged-file "$path" "$LOCAL" "$BASE" "$REMOTE"
+ if test "$path" -nt "$BACKUP" ; then
+ status=0;
+ else
+ while true; do
+ echo "$path seems unchanged."
+ echo -n "Was the merge successful? [y/n] "
+ read answer < /dev/tty
+ case "$answer" in
+ y*|Y*) status=0; break ;;
+ n*|N*) status=1; break ;;
+ esac
+ done
+ fi
+ if test "$status" -eq 0; then
+ mv "$BACKUP" "$path.orig"
+ fi
+ ;;
+ emerge)
+ emacs -f emerge-files-with-ancestor-command "$LOCAL" "$REMOTE" "$BASE" "$path"
+ status=$?
+ if test "$status" -eq 0; then
+ mv "$BACKUP" "$path.orig"
+ fi
+ ;;
+ esac
+ rm -f "$LOCAL" "$REMOTE" "$BASE"
+ if test "$status" -ne 0; then
+ echo "merge of $path failed" 1>&2
+ mv "$BACKUP" "$path"
+ exit 1
+ fi
+ git add "$path"
+}
+
+while case $# in 0) break ;; esac
+do
+ case "$1" in
+ -t|--tool*)
+ case "$#,$1" in
+ *,*=*)
+ merge_tool=`expr "z$1" : 'z-[^=]*=\(.*\)'`
+ ;;
+ 1,*)
+ usage ;;
+ *)
+ merge_tool="$2"
+ shift ;;
+ esac
+ ;;
+ --)
+ break
+ ;;
+ -*)
+ usage
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+done
+
+if test -z "$merge_tool"; then
+ merge_tool=`git-config merge.tool`
+ if test $merge_tool = kdiff3 -o $merge_tool = tkdiff -o \
+ $merge_tool = xxdiff -o $merge_tool = meld ; then
+ unset merge_tool
+ fi
+fi
+
+if test -z "$merge_tool" ; then
+ if type kdiff3 >/dev/null 2>&1 && test -n "$DISPLAY"; then
+ merge_tool="kdiff3";
+ elif type tkdiff >/dev/null 2>&1 && test -n "$DISPLAY"; then
+ merge_tool=tkdiff
+ elif type xxdiff >/dev/null 2>&1 && test -n "$DISPLAY"; then
+ merge_tool=xxdiff
+ elif type meld >/dev/null 2>&1 && test -n "$DISPLAY"; then
+ merge_tool=meld
+ elif type emacs >/dev/null 2>&1; then
+ merge_tool=emerge
+ else
+ echo "No available merge tools available."
+ exit 1
+ fi
+fi
+
+case "$merge_tool" in
+ kdiff3|tkdiff|meld|xxdiff)
+ if ! type "$merge_tool" > /dev/null 2>&1; then
+ echo "The merge tool $merge_tool is not available"
+ exit 1
+ fi
+ ;;
+ emerge)
+ if ! type "emacs" > /dev/null 2>&1; then
+ echo "Emacs is not available"
+ exit 1
+ fi
+ ;;
+ *)
+ echo "Unknown merge tool: $merge_tool"
+ exit 1
+ ;;
+esac
+
+if test $# -eq 0 ; then
+ files=`git ls-files -u --abbrev=8 | colrm 1 24 | sort -u`
+ if test -z "$files" ; then
+ echo "No files need merging"
+ exit 0
+ fi
+ echo Merging the files: $files
+ git ls-files -u --abbrev=8 | colrm 1 24 | sort -u | while read i
+ do
+ merge_file "$i" < /dev/tty > /dev/tty
+ done
+else
+ while test $# -gt 0; do
+ merge_file "$1"
+ shift
+ done
+fi
+exit 0
--
1.5.0.2.312.g5ced-dirty
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Add git-mergetool to run an appropriate merge conflict resolution program
2007-03-06 5:07 [PATCH] Add git-mergetool to run an appropriate merge conflict resolution program Theodore Ts'o
@ 2007-03-06 5:43 ` Junio C Hamano
2007-03-06 12:40 ` Theodore Tso
2007-03-29 3:58 ` Junio C Hamano
1 sibling, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2007-03-06 5:43 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: git
"Theodore Ts'o" <tytso@mit.edu> writes:
> +git-mergetool(1)
> +================
> +
> +NAME
> +----
> +git-mergetool - Forward-port local commits to the updated upstream head
> +
Hmph. We already have a tool to achieve such a goal, and that
is called git-rebase. Why would we want your program? ;-)
> diff --git a/git-mergetool.sh b/git-mergetool.sh
> new file mode 100755
> index 0000000..b961719
> --- /dev/null
> +++ b/git-mergetool.sh
> @@ -0,0 +1,208 @@
> +#!/bin/sh
> +#
> +# This program resolves merge conflicts in git
> +#
> +# Copyright (c) 2006 Theodore Y. Ts'o
> +#
> +# This file is licensed under the GPL v2, or a later version
> +# at the discretion of Linus Torvalds.
Heh ;-).
> +#
> +
> +usage () {
> + echo "Usage: git mergetool [--tool=tool] [file to merge] ..."
> + exit 1
> +}
Do we want to do this by hand ourselves, or dot-source sh-setup
like others? You would also get die() for free.
> +merge_file () {
> ...
> +
> + if test ! -f "$path" ; then
> + echo "$path: file not found"
> + exit 1
> + fi
> +
> + f=`git-ls-files -u "$path"`
> + if test -z "$f" ; then
> + echo "$path: file does not need merging"
> + exit 1
> + fi
You should be able to set IFS to exclude SP and then you only
have to say you do not support LF and HT, both of which are much
less likely than SP to be in the pathname.
> + mv "$path" "$BACKUP"
> + cp "$BACKUP" "$path"
What if $path is a symlink blob? ;-)
> + git cat-file blob ":1:$path" > "$BASE"
> + git cat-file blob ":2:$path" > "$LOCAL"
> + git cat-file blob ":3:$path" > "$REMOTE"
> + case "$merge_tool" in
> + kdiff3)
> ...
> + tkdiff)
> ...
> + meld)
> ...
> + xxdiff)
> ...
It is depressing to see that the differences between the command
lines of these have to be much larger than just the command name
and order of three (or four if we count the result) paths
parameters. I was hoping that we could do something like:
mergetool -t='newmerge $BASE $LOCAL $REMOTE'
> + xxdiff -X --show-merged-pane \
> + -R 'Accel.SaveAsMerged: "Ctrl-S"' \
> + -R 'Accel.Search: "Ctrl+F"' \
> + -R 'Accel.SearchForward: "Ctrl-G"' \
Do these configuration belong to individual scripts like this?
> +if test -z "$merge_tool" ; then
> + if type kdiff3 >/dev/null 2>&1 && test -n "$DISPLAY"; then
> + merge_tool="kdiff3";
> + elif type tkdiff >/dev/null 2>&1 && test -n "$DISPLAY"; then
> + merge_tool=tkdiff
> + elif type xxdiff >/dev/null 2>&1 && test -n "$DISPLAY"; then
> + merge_tool=xxdiff
> + elif type meld >/dev/null 2>&1 && test -n "$DISPLAY"; then
> + merge_tool=meld
> + elif type emacs >/dev/null 2>&1; then
> + merge_tool=emerge
> + else
> + echo "No available merge tools available."
Curious choice of words...
> +if test $# -eq 0 ; then
> + files=`git ls-files -u --abbrev=8 | colrm 1 24 | sort -u`
Careful. I think --abbrev=8 just means use at least 8 but more
as needed to make them unique. sed -e 's/^[^ ]* //'
(whitespace are HTs) would be safer and simpler, as you are not
dealing with a pathname that has LF in it anyway.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add git-mergetool to run an appropriate merge conflict resolution program
2007-03-06 5:43 ` Junio C Hamano
@ 2007-03-06 12:40 ` Theodore Tso
2007-03-06 22:55 ` Linus Torvalds
2007-03-06 23:02 ` Junio C Hamano
0 siblings, 2 replies; 7+ messages in thread
From: Theodore Tso @ 2007-03-06 12:40 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Mon, Mar 05, 2007 at 09:43:48PM -0800, Junio C Hamano wrote:
> "Theodore Ts'o" <tytso@mit.edu> writes:
>
> > +git-mergetool(1)
> > +================
> > +
> > +NAME
> > +----
> > +git-mergetool - Forward-port local commits to the updated upstream head
> > +
>
> Hmph. We already have a tool to achieve such a goal, and that
> is called git-rebase. Why would we want your program? ;-)
Oops, sorry, I thought I had fixed that. Guess you figured out which
program I used as a man page template, huh? :-)
> > +# This file is licensed under the GPL v2, or a later version
> > +# at the discretion of Linus Torvalds.
>
> Heh ;-).
Hey, that's what the COPYING file requested, and it was late when I
started doing the git package integration, hence the stupid think-o
with the man page. :-)
I assume you would prefer that it read Junio instead? Should we
change the COPYING while we're at it, perhaps after consulting with
Linus since he still owns so a fair amount of the copyright on git?
It seems that if we're going to pre-collect permissions to move to
GPLv3, it ought to be either you or him....
> Do we want to do this by hand ourselves, or dot-source sh-setup
> like others? You would also get die() for free.
Good point, I'll use git-sh-setup.
> You should be able to set IFS to exclude SP and then you only
> have to say you do not support LF and HT, both of which are much
> less likely than SP to be in the pathname.
Do we have any coding guidelines about what characters we have to
support in filenames? I had assumed that we should support at least
SP and HT, but life does get easier if we don't need to worry about HT.
> > + mv "$path" "$BACKUP"
> > + cp "$BACKUP" "$path"
>
> What if $path is a symlink blob? ;-)
Yeah, I need to add special case code for symlinks.
> > + case "$merge_tool" in
> > + kdiff3)
> > ...
> > + tkdiff)
> > ...
> > + meld)
> > ...
> > + xxdiff)
> > ...
>
> It is depressing to see that the differences between the command
> lines of these have to be much larger than just the command name
> and order of three (or four if we count the result) paths
> parameters.
Yep, it is depressing. There is no standard calling convention, and
there is no standard exit status convention, either. Hence the
requirement for meld and xxdiff to check to see if the file has
changed. Grump....
> > + xxdiff -X --show-merged-pane \
> > + -R 'Accel.SaveAsMerged: "Ctrl-S"' \
> > + -R 'Accel.Search: "Ctrl+F"' \
> > + -R 'Accel.SearchForward: "Ctrl-G"' \
>
> Do these configuration belong to individual scripts like this?
The problem is that if you don't do this, using xxdiff is user-hostile
in the extreme. The problem isn't so much that the save command has
no accelerators, but the Save menu gives you five (5!) save options.
You can save the merged file as:
* The right file
* The middle file
* The left file
* The file that was specified as the output on the command-line
* Some user-specified file (save-as)
So without those resource changes, the user would have to click on the
File menu, and drag down to the "correct" save option or the file with
the resolved merge conflicts would get saved to some random place.
Gaaah. I thought xxdiff was user hostile in the extreme, but Martin
Langhoff really wanted it, and he was right that xxdiff will give you
a built-in character-diff so you can see what changed on the
individual line. So the resource changes were in my opinion the
minimum necessary so that the user would have some chance of seeing
which one of the five save options would actually do the right thing
with respect to git-mergetool.
> > + echo "No available merge tools available."
>
> Curious choice of words...
>
Yeah, that should probably read "merge conflict resolution programs",
even though that's a lot more words.
> > +if test $# -eq 0 ; then
> > + files=`git ls-files -u --abbrev=8 | colrm 1 24 | sort -u`
>
> Careful. I think --abbrev=8 just means use at least 8 but more
> as needed to make them unique. sed -e 's/^[^ ]* //'
> (whitespace are HTs) would be safer and simpler, as you are not
> dealing with a pathname that has LF in it anyway.
OK, I can do that. Alternatively I guess I could submit a patch which
caused git-ls-files to only list the files that still needed merging.
(i.e., git-ls-files -u --nostage".) Do you have any preferences?
- Ted
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add git-mergetool to run an appropriate merge conflict resolution program
2007-03-06 12:40 ` Theodore Tso
@ 2007-03-06 22:55 ` Linus Torvalds
2007-03-06 23:02 ` Junio C Hamano
1 sibling, 0 replies; 7+ messages in thread
From: Linus Torvalds @ 2007-03-06 22:55 UTC (permalink / raw)
To: Theodore Tso; +Cc: Junio C Hamano, git
On Tue, 6 Mar 2007, Theodore Tso wrote:
>
> I assume you would prefer that it read Junio instead? Should we
> change the COPYING while we're at it, perhaps after consulting with
> Linus since he still owns so a fair amount of the copyright on git?
> It seems that if we're going to pre-collect permissions to move to
> GPLv3, it ought to be either you or him....
I'm ok with Junio controlling it as far as I'm concerned. After all, he's
been the maintainer for the last two years, so he gets the blame, and he'd
better get the credit too.
Linus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add git-mergetool to run an appropriate merge conflict resolution program
2007-03-06 12:40 ` Theodore Tso
2007-03-06 22:55 ` Linus Torvalds
@ 2007-03-06 23:02 ` Junio C Hamano
1 sibling, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2007-03-06 23:02 UTC (permalink / raw)
To: Theodore Tso; +Cc: git
Theodore Tso <tytso@mit.edu> writes:
>> > +# This file is licensed under the GPL v2, or a later version
>> > +# at the discretion of Linus Torvalds.
>>
>> Heh ;-).
>
> Hey, that's what the COPYING file requested, and it was late when I
> started doing the git package integration, hence the stupid think-o
> with the man page. :-)
>
> I assume you would prefer that it read Junio instead?
Oh, no, sorry. The text itself is just fine as is, if that is
the way you want.
I just laughed out because I remembered the list discussion
(which might also have cc'ed the kernel list, but I do not
remember) about possible relicensing schenario, where Linus
mentioned that exact clause in the COPYING file, saying that his
discretion would by now be to let me decide ;-).
>> You should be able to set IFS to exclude SP and then you only
>> have to say you do not support LF and HT, both of which are much
>> less likely than SP to be in the pathname.
>
> Do we have any coding guidelines about what characters we have to
> support in filenames? I had assumed that we should support at least
> SP and HT, but life does get easier if we don't need to worry about HT.
The core scripts, at least the ones I personally use, are meant
to handle all characters, including SP, HT and LF, so if there
were any guidelines that would be it. However, your particular
case to interface with external editor needs `eval` with sq
magic if it needs to be coded in portable bourne, which can be
done, but I suspect it is not worth doing, as we would not see
HT in pathnames in the practice. UNIXy folks tend to avoid any
whitespaces in the filenames, and Windows folks cannot use HT in
pathnames as far as I understand.
> Yeah, that should probably read "merge conflict resolution programs",
> even though that's a lot more words.
>
>> > +if test $# -eq 0 ; then
>> > + files=`git ls-files -u --abbrev=8 | colrm 1 24 | sort -u`
>>
>> Careful. I think --abbrev=8 just means use at least 8 but more
>> as needed to make them unique. sed -e 's/^[^ ]* //'
>> (whitespace are HTs) would be safer and simpler, as you are not
>> dealing with a pathname that has LF in it anyway.
>
> OK, I can do that. Alternatively I guess I could submit a patch which
> caused git-ls-files to only list the files that still needed merging.
> (i.e., git-ls-files -u --nostage".) Do you have any preferences?
The latter would be more useful in general, and something I
should have done long time ago to help scripts. Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Add git-mergetool to run an appropriate merge conflict resolution program
2007-03-06 5:07 [PATCH] Add git-mergetool to run an appropriate merge conflict resolution program Theodore Ts'o
2007-03-06 5:43 ` Junio C Hamano
@ 2007-03-29 3:58 ` Junio C Hamano
2007-03-29 14:20 ` Theodore Tso
1 sibling, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2007-03-29 3:58 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: git
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Add git-mergetool to run an appropriate merge conflict resolution program
2007-03-29 3:58 ` Junio C Hamano
@ 2007-03-29 14:20 ` Theodore Tso
0 siblings, 0 replies; 7+ messages in thread
From: Theodore Tso @ 2007-03-29 14:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Wed, Mar 28, 2007 at 08:58:49PM -0700, Junio C Hamano wrote:
> 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:
>
> A few observations.
>
> (1) Saying "a" <Return> does not let me exit. It keeps asking
> the same question.
Yeah, I fixed that last night, along with a bunch of other git
mergetool cleanups. I was about to request you to do a pull when I
noticed your e-mail.
> (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.
OK, let me fix up the display and try to clean up the other messages.
I agree that your output looks much nicer.
- Ted
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-03-29 14:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-06 5:07 [PATCH] Add git-mergetool to run an appropriate merge conflict resolution program Theodore Ts'o
2007-03-06 5:43 ` Junio C Hamano
2007-03-06 12:40 ` Theodore Tso
2007-03-06 22:55 ` Linus Torvalds
2007-03-06 23:02 ` Junio C Hamano
2007-03-29 3:58 ` Junio C Hamano
2007-03-29 14:20 ` Theodore Tso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).