git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan del Strother <jon.delStrother@bestbefore.tv>
To: git@vger.kernel.org
Cc: Jonathan del Strother <jon.delStrother@bestbefore.tv>
Subject: [PATCH] Offer to print changes while running git-mergetool
Date: Fri,  6 Feb 2009 14:32:25 +0000	[thread overview]
Message-ID: <1233930745-77930-1-git-send-email-jon.delStrother@bestbefore.tv> (raw)

Add a "Show changes" option to each prompt in mergetool. This prints the conflicted changes on the current file, using 'git log -p --merge <file>'

Signed-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv>
---

I frequently find myself running git-mergetool, then finding halfway through that I need to review the changes that produced that conflict.
How about something like this, for showing the changes from within mergetool?

 git-mergetool.sh |   37 ++++++++++++++++++++++++++++++-------
 1 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/git-mergetool.sh b/git-mergetool.sh
index 87fa88a..9df91d8 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -62,7 +62,7 @@ describe_file () {
 
 resolve_symlink_merge () {
     while true; do
-	printf "Use (l)ocal or (r)emote, or (a)bort? "
+	printf "Use (l)ocal or (r)emote, (s)how changes, or (a)bort? "
 	read ans
 	case "$ans" in
 	    [lL]*)
@@ -77,6 +77,12 @@ resolve_symlink_merge () {
 		cleanup_temp_files --save-backup
 		return 0
 		;;
+		[sS]*)
+		git log -p --merge "$MERGED"
+		printf "\n"
+		resolve_symlink_merge
+		return
+		;;
 	    [aA]*)
 		return 1
 		;;
@@ -87,9 +93,9 @@ resolve_symlink_merge () {
 resolve_deleted_merge () {
     while true; do
 	if base_present; then
-	    printf "Use (m)odified or (d)eleted file, or (a)bort? "
+	    printf "Use (m)odified or (d)eleted file, (s)how changes, or (a)bort? "
 	else
-	    printf "Use (c)reated or (d)eleted file, or (a)bort? "
+	    printf "Use (c)reated or (d)eleted file, (s)how changes, or (a)bort? "
 	fi
 	read ans
 	case "$ans" in
@@ -103,6 +109,12 @@ resolve_deleted_merge () {
 		cleanup_temp_files
 		return 0
 		;;
+		[sS]*)
+		git log -p --merge "$MERGED"
+		printf "\n"
+		resolve_deleted_merge
+		return
+		;;
 	    [aA]*)
 		return 1
 		;;
@@ -183,10 +195,21 @@ merge_file () {
     echo "Normal merge conflict for '$MERGED':"
     describe_file "$local_mode" "local" "$LOCAL"
     describe_file "$remote_mode" "remote" "$REMOTE"
-    if "$prompt" = true; then
-	printf "Hit return to start merge resolution tool (%s): " "$merge_tool"
-	read ans
-    fi
+	if "$prompt" = true; then
+		while true; do
+			printf "(S)how changes, or hit return to start merge resolution tool (%s): " "$merge_tool"
+			read ans
+			case "$ans" in
+				[sS]*)
+				git log -p --merge "$MERGED"
+				printf "\n"
+				;;
+				*)
+				break
+				;;
+			esac
+		done
+	fi
 
     case "$merge_tool" in
 	kdiff3)
-- 
1.6.1.2.390.gba743.dirty

             reply	other threads:[~2009-02-06 14:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-06 14:32 Jonathan del Strother [this message]
2009-02-06 14:41 ` [PATCH] Offer to print changes while running git-mergetool Jonathan del Strother
2009-02-06 17:47   ` Junio C Hamano
2009-02-06 19:08     ` Jonathan del Strother
2009-02-07  0:21       ` Junio C Hamano
2009-02-07  8:11 ` Junio C Hamano
2009-02-07 12:01   ` Jonathan del Strother
2009-02-08  1:24     ` Charles Bailey
2009-02-08 11:43       ` Jonathan del Strother
2009-02-08 12:38         ` Charles Bailey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1233930745-77930-1-git-send-email-jon.delStrother@bestbefore.tv \
    --to=jon.delstrother@bestbefore.tv \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).