Skip to content

Commit 52d196a

Browse files
ar-cetitecpatthoyts
authored andcommitted
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 <[email protected]> Signed-off-by: Pat Thoyts <[email protected]>
1 parent af465c0 commit 52d196a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/tools.tcl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ proc tools_populate_one {fullname} {
6969
proc tools_exec {fullname} {
7070
global repo_config env current_diff_path
7171
global current_branch is_detached
72+
global selected_paths
7273

7374
if {[is_config_true "guitool.$fullname.needsfile"]} {
7475
if {$current_diff_path eq {}} {
@@ -100,6 +101,7 @@ proc tools_exec {fullname} {
100101

101102
set env(GIT_GUITOOL) $fullname
102103
set env(FILENAME) $current_diff_path
104+
set env(FILENAMES) [join [array names selected_paths] \n]
103105
if {$is_detached} {
104106
set env(CUR_BRANCH) ""
105107
} else {
@@ -121,6 +123,7 @@ proc tools_exec {fullname} {
121123

122124
unset env(GIT_GUITOOL)
123125
unset env(FILENAME)
126+
unset env(FILENAMES)
124127
unset env(CUR_BRANCH)
125128
catch { unset env(ARGS) }
126129
catch { unset env(REVISION) }

0 commit comments

Comments
 (0)