{"thread":{"id":"23209","subject":"[PATCH 2/2] Allow git gui to display the diff with the HEAD in the case of conflicts.","startedAt":"2010-03-28T02:08:02Z","lastAt":"2010-03-28T02:08:02Z","messageCount":1,"participants":["Jon Seymour"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"137988","messageId":"2cfc40321003271908j1b5a8228x93a86216201110c4@mail.gmail.com","threadId":"23209","inReplyTo":null,"subject":"[PATCH 2/2] Allow 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-28T02:08:02Z","receivedAt":"2010-03-28T02:08:02Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"If the configuration variable gui.conflictsdiffwithhead is true,\nthen the diff displayed for conflicted paths will be the difference\nbetween the working tree and the HEAD.\n\nThe rationale for this change is that the previous behaviour did not allow\nthe user to make an informed decision about whether \"Use Remote Version\"\nwas safe since non-conflicting changes in the remote branch were already\nin the index and thus not visible from git gui.\n\nWith this change, the gui displays what the index would contain if\nthe current working tree copy (including diff markers) 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.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n Documentation/config.txt |    9 +++++++++\n git-gui/lib/diff.tcl     |    6 +++++-\n 2 files changed, 14 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 06b2f82..352b573 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -1032,6 +1032,15 @@ gui.commitmsgwidth::\n \tDefines how wide the commit message window is in the\n \tlinkgit:git-gui[1]. \"75\" is the default.\n\n+gui.conflictsdiffwithhead::\n+\tIf set to \"true\", then the diff displayed by the gui for unstaged conflicted\n+\tchanges is the diff between the working tree and the HEAD. This mode\n+\tof operation allows the user to assess whether use of \"Use Remote\nVersion\" is safe\n+\tor will discard successfully merged hunks from the remote branch.\n+\tIf set to \"false\", the diff shown for all unstaged changes is the difference\n+\tbetween the working tree and the index.\tDefault: \"false\".\n+\n+\n gui.diffcontext::\n \tSpecifies how many context lines should be used in calls to diff\n \tmade by the linkgit:git-gui[1]. The default is \"5\".\ndiff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl\nindex e7b1986..7aeb98d 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+            if {$is_unmerged && [is_config_true gui.conflictsdiffwithhead]} {\n+                 lappend cmd \"HEAD\"\n+            }\n+        }\n \tif {$add_opts ne {}} {\n \t\teval lappend cmd $add_opts\n \t} else {\n-- \n1.6.6.1\n"}]}