{"thread":{"id":"23244","subject":"[PATCH v2 1/2] git-gui: Introduce is_unmerged global variable to encapsulate its derivation.","startedAt":"2010-03-29T23:01:05Z","lastAt":"2010-03-29T23:01:05Z","messageCount":1,"participants":["Jon Seymour"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"138141","messageId":"2cfc40321003291601x2b79f816u1cf1f46ccf1a6cb4@mail.gmail.com","threadId":"23244","inReplyTo":null,"subject":"[PATCH v2 1/2] git-gui: Introduce is_unmerged global variable to encapsulate its derivation.","fromName":"Jon Seymour","fromEmail":"jon.seymour@gmail.com","sentAt":"2010-03-29T23:01:05Z","receivedAt":"2010-03-29T23:01:05Z","isPatch":true,"sender":{"key":"jon.seymour@gmail.com","avatar":"https://avatars.githubusercontent.com/u/207131?v=4"},"body":"Defined is_unmerged to be [expr {[string first {U} $m] >= 0}]\nand then replaced uses of {[string first {U} $m] >= 0} with {$is_unmerged}.\n\nThis change is made because the subsequent patch will introduce a 3rd\nuse of this expression.\n\nSigned-off-by: Jon Seymour <jon.seymour@gmail.com>\n---\n git-gui/lib/diff.tcl |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl\nindex ec8c11e..e7b1986 100644\n--- a/git-gui/lib/diff.tcl\n+++ b/git-gui/lib/diff.tcl\n@@ -80,6 +80,7 @@ proc show_diff {path w {lno {}} {scroll_pos {}}\n{callback {}}} {\n \tglobal ui_diff ui_index ui_workdir\n \tglobal current_diff_path current_diff_side current_diff_header\n \tglobal current_diff_queue\n+\tglobal is_unmerged\n\n \tif {$diff_active || ![lock_index read]} return\n\n@@ -98,6 +99,7 @@ proc show_diff {path w {lno {}} {scroll_pos {}}\n{callback {}}} {\n \tset s $file_states($path)\n \tset m [lindex $s 0]\n \tset is_conflict_diff 0\n+\tset is_unmerged [expr {[string first {U} $m] >= 0}]\n \tset current_diff_path $path\n \tset current_diff_side $w\n \tset current_diff_queue {}\n@@ -105,7 +107,7 @@ proc show_diff {path w {lno {}} {scroll_pos {}}\n{callback {}}} {\n\n \tset cont_info [list $scroll_pos $callback]\n\n-\tif {[string first {U} $m] >= 0} {\n+\tif {$is_unmerged} {\n \t\tmerge_load_stages $path [list show_unmerged_diff $cont_info]\n \t} elseif {$m eq {_O}} {\n \t\tshow_other_diff $path $w $m $cont_info\n@@ -258,6 +260,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n \tglobal is_3way_diff is_submodule_diff diff_active repo_config\n \tglobal ui_diff ui_index ui_workdir\n \tglobal current_diff_path current_diff_side current_diff_header\n+\tglobal is_unmerged\n\n \tset path $current_diff_path\n \tset w $current_diff_side\n@@ -274,7 +277,7 @@ proc start_show_diff {cont_info {add_opts {}}} {\n \t\tlappend cmd diff-index\n \t\tlappend cmd --cached\n \t} elseif {$w eq $ui_workdir} {\n-\t\tif {[string first {U} $m] >= 0} {\n+\t        if {$is_unmerged} {\n \t\t\tlappend cmd diff\n \t\t} else {\n \t\t\tlappend cmd diff-files\n-- \n1.6.6.1\n"}]}