git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 2/2] Change git gui to display the diff with the HEAD in the  case of conflicts.
@ 2010-03-28  3:38 Jon Seymour
  0 siblings, 0 replies; only message in thread
From: Jon Seymour @ 2010-03-28  3:38 UTC (permalink / raw
  To: Git Mailing List; +Cc: spearce

The rationale for this change is that the previous behaviour did not allow
the user to make an informed decision about the likely consequences
of "Use Local Version" or "Stage to commit".

For example, use of "Use Local Version" would silently discard from the index,
and the working tree any successfully merged remote hunks. Since these hunks
had never been displayed to the user, this loss would be unnoticed and
unexpected.

In the case of "Stage to commit" the successfully merged remote hunks are
preserved in the index and the working tree, but unless the user checks
the diff after the action has been taken, the user may not be aware that these
hunks were staged in the first place since these hunks are not visible until
after the "Stage to commit" action has been taken.

With this change, the gui displays what the index would contain if
the current working tree copy (including diff markers, if any) was staged
to the index as is. If there are successfully merged hunks from the remote
branch in the index, then these will be visible in diff. With this change
the potential consequences of both "Use Local Version" and "Stage to commit" are
directly visible.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
---
Ok, here's the change that makes the proposed safe behaviour, the
default behaviour.

I can supply a patch to make it optional upon request, but I think
that is a dumb idea since it makes the default behaviour unsafe and
requires
configuration to get safe behavour.

       [PATCH 1/2] Introduce is_unmerged global variable to
encapsulate its derivation.
---
 git-gui/lib/diff.tcl |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
index e7b1986..a017fba 100644
--- a/git-gui/lib/diff.tcl
+++ b/git-gui/lib/diff.tcl
@@ -300,7 +300,11 @@ proc start_show_diff {cont_info {add_opts {}}} {
 	}
 	if {$w eq $ui_index} {
 		lappend cmd [PARENT]
-	}
+	} else {
+		if {$is_unmerged} {
+			lappend cmd "HEAD"
+		}
+        }
 	if {$add_opts ne {}} {
 		eval lappend cmd $add_opts
 	} else {
-- 
1.6.6.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-03-28  3:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-28  3:38 [PATCH 2/2] Change git gui to display the diff with the HEAD in the case of conflicts Jon Seymour

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).