{"thread":{"id":"23245","subject":"[PATCH v2 2/2] git-gui: change to display the diff with the HEAD in the case of conflicts.","startedAt":"2010-03-29T23:01:21Z","lastAt":"2010-03-29T23:01:21Z","messageCount":1,"participants":["Jon Seymour"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"138142","messageId":"2cfc40321003291601v424caa0dxa5554768230297ec@mail.gmail.com","threadId":"23245","inReplyTo":null,"subject":"[PATCH v2 2/2] git-gui: change to display the diff with the HEAD in the case of conflicts.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-03-29T23:01:21Z","receivedAt":"2010-03-29T23:01:21Z","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\" for conflicted files. The\nreason for this is that in the conflicted case, successfully staged\nremote hunks are effectively invisible to user (via the git-gui interface)\nand hence cannot inform the user's decision making process.\n\nFor example, previously use of \"Use Local Version\" would silently discard\nfrom the index, and the working tree any successfully merged remote hunks.\nSince these hunks had never been displayed to the user, this\nloss would be unnoticed and unexpected.\n\nIn the case of \"Stage to commit\", the successfully merged remote\nhunks would be preserved in the index and the working tree but the fact\nthat there are successfully merged remote hunks would not be not\nvisible until after the \"Stage to commit\" action has been taken.\nIf the user did not check diff _after_ taking the action, the user\nmay have unwittingly commit changes from a remote hunk\nthat she was not aware of.\n\nWith this change, in the case of conflicted paths only, git-gui displays\nwhat the index would contain if the current working tree copy was\nstaged to the index as is. If there are successfully merged hunks\nfrom the remote branch in the index, then these will be visible in diff,\nthus making the potential consequences of both \"Use Local Version\"\nand \"Stage to commit\" directly visible prior to the user's action.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\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"}]}