git-gui: support for $FILENAMES in tool definitions
This adds a FILENAMES environment variable, which contains the repository pathnames of all selected files the list. The variable contains the names separated by LF (\n, \x0a). If the file names contain LF characters, the tool command might be unable to unambiguously split the value of $FILENAME into the separate names. Note that the file marked and diffed immediately after starting the GUI up, is not actually selected. One must click on it once to really select it. Signed-off-by: Alex Riesen <alexander.riesen@cetitec.com> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Alex Riesen committed
Jun 28, 2016 at 10:57 UTC
52d196af6a5cb8441028914876a60ecec6c464e7
1 file changed
+3
lib/tools.tcl
+3
@@ -69,6 +69,7 @@ proc tools_populate_one {fullname} {
69
proc tools_exec {fullname} {
70
global repo_config env current_diff_path
71
global current_branch is_detached
72
+ global selected_paths
73
74
if {[is_config_true "guitool.$fullname.needsfile"]} {
75
if {$current_diff_path eq {}} {
@@ -100,6 +101,7 @@ proc tools_exec {fullname} {
101
102
set env(GIT_GUITOOL) $fullname
103
set env(FILENAME) $current_diff_path
104
+ set env(FILENAMES) [join [array names selected_paths] \n]
105
if {$is_detached} {
106
set env(CUR_BRANCH) ""
107
} else {
@@ -121,6 +123,7 @@ proc tools_exec {fullname} {
123
124
unset env(GIT_GUITOOL)
125
unset env(FILENAME)
126
+ unset env(FILENAMES)
127
unset env(CUR_BRANCH)
128
catch { unset env(ARGS) }
129
catch { unset env(REVISION) }