{"thread":{"id":"42731","subject":"[PATCH 1/2] git-gui: support for $FILENAMES in tool definitions","startedAt":"2016-06-28T08:58:20Z","lastAt":"2016-10-03T10:02:21Z","messageCount":3,"participants":["Alex Riesen","Pat Thoyts"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"290353","messageId":"20160628085742.GD3710@pflmari","threadId":"42731","inReplyTo":null,"subject":"[PATCH 1/2] git-gui: support for $FILENAMES in tool definitions","fromName":"Alex Riesen","fromEmail":"alexander.riesen@cetitec.com","sentAt":"2016-06-28T08:57:42Z","receivedAt":"2016-06-28T08:58:20Z","isPatch":true,"sender":{"key":"alexander.riesen@cetitec.com","avatar":"https://avatars.githubusercontent.com/u/24452597?v=4"},"body":"This addes a FILENAMES environment variable, which contains the repository\npathnames of all selected files the list.\nThe variable contains the names separated by LF (\\n, \\x0a).\n\nIf the file names contain LF characters, the tool command might be unable to\nunambiguosly split the value of $FILENAME into the separate names.\n\nNote that the file marked and diffed immediately after starting the GUI up,\nis not actually selected. One must click on it once to really select it.\n\nSigned-off-by: Alex Riesen <alexander.riesen@cetitec.com>\n---\n lib/tools.tcl | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/lib/tools.tcl b/lib/tools.tcl\nindex 6ec9411..413f1a1 100644\n--- a/lib/tools.tcl\n+++ b/lib/tools.tcl\n@@ -69,6 +69,7 @@ proc tools_populate_one {fullname} {\n proc tools_exec {fullname} {\n \tglobal repo_config env current_diff_path\n \tglobal current_branch is_detached\n+\tglobal selected_paths\n \n \tif {[is_config_true \"guitool.$fullname.needsfile\"]} {\n \t\tif {$current_diff_path eq {}} {\n@@ -100,6 +101,7 @@ proc tools_exec {fullname} {\n \n \tset env(GIT_GUITOOL) $fullname\n \tset env(FILENAME) $current_diff_path\n+\tset env(FILENAMES) [join [array names selected_paths] \\n]\n \tif {$is_detached} {\n \t\tset env(CUR_BRANCH) \"\"\n \t} else {\n@@ -121,6 +123,7 @@ proc tools_exec {fullname} {\n \n \tunset env(GIT_GUITOOL)\n \tunset env(FILENAME)\n+\tunset env(FILENAMES)\n \tunset env(CUR_BRANCH)\n \tcatch { unset env(ARGS) }\n \tcatch { unset env(REVISION) }\n-- \n2.9.0.45.g28c608e.dirty\n\n\n---\nDiese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.\nhttps://www.avast.com/antivirus\n\n"},{"id":"290354","messageId":"20160628085925.GE3710@pflmari","threadId":"42731","inReplyTo":"20160628085742.GD3710@pflmari","subject":"[PATCH 2/2] git-gui: ensure the file in the diff pane is in the list of selected files","fromName":"Alex Riesen","fromEmail":"alexander.riesen@cetitec.com","sentAt":"2016-06-28T08:59:25Z","receivedAt":"2016-06-28T09:01:02Z","isPatch":true,"sender":{"key":"alexander.riesen@cetitec.com","avatar":"https://avatars.githubusercontent.com/u/24452597?v=4"},"body":"It is very confusing that the file which diff is displayed is marked as\nselected, but it is not in fact selected (that means the array of selected\nfiles does not include the file in question).\n\nFixing this also improves the use of $FILENAMES in custom defined tools: one\ndoes not have to click the file in the list to make it selected.\n\nSigned-off-by: Alex Riesen <alexander.riesen@cetitec.com>\n---\n lib/diff.tcl | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/lib/diff.tcl b/lib/diff.tcl\nindex 0d56986..30bdd69 100644\n--- a/lib/diff.tcl\n+++ b/lib/diff.tcl\n@@ -127,6 +127,9 @@ proc show_diff {path w {lno {}} {scroll_pos {}} {callback {}}} {\n \t} else {\n \t\tstart_show_diff $cont_info\n \t}\n+\n+\tglobal current_diff_path selected_paths\n+\tset selected_paths($current_diff_path) 1\n }\n \n proc show_unmerged_diff {cont_info} {\n-- \n2.9.0.45.g28c608e.dirty\n\n\n---\nDiese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.\nhttps://www.avast.com/antivirus\n\n"},{"id":"303077","messageId":"87eg3xwy1n.fsf@red.patthoyts.tk","threadId":"42731","inReplyTo":"20160628085925.GE3710@pflmari","subject":"Re: [PATCH 2/2] git-gui: ensure the file in the diff pane is in the list of selected files","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2016-10-03T10:02:12Z","receivedAt":"2016-10-03T10:02:21Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"Alex Riesen <alexander.riesen@cetitec.com> writes:\n\n>It is very confusing that the file which diff is displayed is marked as\n>selected, but it is not in fact selected (that means the array of selected\n>files does not include the file in question).\n>\n>Fixing this also improves the use of $FILENAMES in custom defined tools: one\n>does not have to click the file in the list to make it selected.\n>\n>Signed-off-by: Alex Riesen <alexander.riesen@cetitec.com>\n>---\n> lib/diff.tcl | 3 +++\n> 1 file changed, 3 insertions(+)\n>\n>diff --git a/lib/diff.tcl b/lib/diff.tcl\n>index 0d56986..30bdd69 100644\n>--- a/lib/diff.tcl\n>+++ b/lib/diff.tcl\n>@@ -127,6 +127,9 @@ proc show_diff {path w {lno {}} {scroll_pos {}} {callback {}}} {\n> \t} else {\n> \t\tstart_show_diff $cont_info\n> \t}\n>+\n>+\tglobal current_diff_path selected_paths\n>+\tset selected_paths($current_diff_path) 1\n> }\n> \n> proc show_unmerged_diff {cont_info} {\n\nThese both look good. Applied with minor changes to the commit message\nfor patch 1.\n\nThank you,\n\n-- \nPat Thoyts                            http://www.patthoyts.tk/\nPGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD\n"}]}