git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/2] Support for $FILENAMES in tool definitions

From
Alex Riesen <alexander.riesen@cetitec.com>
Date
Jun 27, 2016, 13:21 UTC
Message-ID
<20160627132137.GC4194@pflmari>

This adds a FILENAMES environment variable, which contains the repository pathnames of all selected files the list. The variable contains the names separated by spaces.

Similar to the FILENAME it is broken yet, if the names contain spaces.

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>
---

One day the FILENAME and FILENAMES will have to be fixed to properly pass the file names with spaces. Sorry, I couldn't find how to do it this time around.

 lib/tools.tcl | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/lib/tools.tcl b/lib/tools.tcl
index 6ec9411..14d556f 100644
--- a/lib/tools.tcl
+++ b/lib/tools.tcl
@@ -69,6 +69,7 @@ proc tools_populate_one {fullname} {
 proc tools_exec {fullname} {
 	global repo_config env current_diff_path
 	global current_branch is_detached
+	global selected_paths
 
 	if {[is_config_true "guitool.$fullname.needsfile"]} {
 		if {$current_diff_path eq {}} {
@@ -100,6 +101,7 @@ proc tools_exec {fullname} {
 
 	set env(GIT_GUITOOL) $fullname
 	set env(FILENAME) $current_diff_path
+	set env(FILENAMES) [array names selected_paths]
 	if {$is_detached} {
 		set env(CUR_BRANCH) ""
 	} else {
@@ -121,6 +123,7 @@ proc tools_exec {fullname} {
 
 	unset env(GIT_GUITOOL)
 	unset env(FILENAME)
+	unset env(FILENAMES)
 	unset env(CUR_BRANCH)
 	catch { unset env(ARGS) }
 	catch { unset env(REVISION) }
-- 
2.9.0.45.g28c608e.dirty


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus
Next: Alex Riesen
Message 1 of 10 in “Support for $FILENAMES in tool definitions”
  1. 1/2 Support for $FILENAMES in tool definitionsAlex Riesen, Jun 27, 2016
  2. 2/2 Ensure the file in the diff pane is always in the list of selected filesAlex Riesen, Jun 27, 2016
  3. Jakub NarębskiJun 27, 2016
  4. Alex RiesenJun 28, 2016
  5. Johannes SchindelinJun 27, 2016
  6. Alex RiesenJun 28, 2016
  7. Jakub NarębskiJun 27, 2016
  8. Junio C HamanoJun 27, 2016
  9. Jakub NarębskiJun 27, 2016
  10. Alex RiesenJun 28, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.