{"thread":{"id":"23211","subject":"[PATCH 2/2] Change git gui to display the diff with the HEAD in the case of conflicts.","startedAt":"2010-03-28T03:38:02Z","lastAt":"2010-03-28T03:38:02Z","messageCount":1,"participants":["Jon Seymour"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"137991","messageId":"2cfc40321003272038r767cc042u555aa7685c8836f@mail.gmail.com","threadId":"23211","inReplyTo":null,"subject":"[PATCH 2/2] Change git gui to display the diff with the HEAD in the case of conflicts.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-03-28T03:38:02Z","receivedAt":"2010-03-28T03:38:02Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"The rationale for this change is that the previous behaviour did not allow\nthe user to make an informed decision about the likely consequences\nof \"Use Local Version\" or \"Stage to commit\".\n\nFor example, use of \"Use Local Version\" would silently discard from the index,\nand the working tree any successfully merged remote hunks. Since these hunks\nhad never been displayed to the user, this loss would be unnoticed and\nunexpected.\n\nIn the case of \"Stage to commit\" the successfully merged remote hunks are\npreserved in the index and the working tree, but unless the user checks\nthe diff after the action has been taken, the user may not be aware that these\nhunks were staged in the first place since these hunks are not visible until\nafter the \"Stage to commit\" action has been taken.\n\nWith this change, the gui displays what the index would contain if\nthe current working tree copy (including diff markers, if any) was staged\nto the index as is. If there are successfully merged hunks from the remote\nbranch in the index, then these will be visible in diff. With this change\nthe potential consequences of both \"Use Local Version\" and \"Stage to commit\" are\ndirectly visible.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\nOk, here's the change that makes the proposed safe behaviour, the\ndefault behaviour.\n\nI can supply a patch to make it optional upon request, but I think\nthat is a dumb idea since it makes the default behaviour unsafe and\nrequires\nconfiguration to get safe behavour.\n\n       [PATCH 1/2] Introduce is_unmerged global variable to\nencapsulate its derivation.\n---\n git-gui/lib/diff.tcl |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl\nindex e7b1986..a017fba 100644\n--- a/git-gui/lib/diff.tcl\n+++ b/git-gui/lib/diff.tcl\n@@ -300,7 +300,11 @@ proc start_show_diff {cont_info {add_opts {}}} {\n \t}\n \tif {$w eq $ui_index} {\n \t\tlappend cmd [PARENT]\n-\t}\n+\t} else {\n+\t\tif {$is_unmerged} {\n+\t\t\tlappend cmd \"HEAD\"\n+\t\t}\n+        }\n \tif {$add_opts ne {}} {\n \t\teval lappend cmd $add_opts\n \t} else {\n-- \n1.6.6.1\n"}]}