git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 1/2] git-gui: support for $FILENAMES in tool definitions
@ 2016-06-28  8:57 Alex Riesen
  2016-06-28  8:59 ` [PATCH 2/2] git-gui: ensure the file in the diff pane is in the list of selected files Alex Riesen
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Riesen @ 2016-06-28  8:57 UTC (permalink / raw)
  To: git; +Cc: Pat Thoyts, Junio C Hamano, Jakub Narębski,
	Johannes Schindelin

This addes 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
unambiguosly 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>
---
 lib/tools.tcl | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/tools.tcl b/lib/tools.tcl
index 6ec9411..413f1a1 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) [join [array names selected_paths] \n]
 	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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] git-gui: ensure the file in the diff pane is in the list of selected files
  2016-06-28  8:57 [PATCH 1/2] git-gui: support for $FILENAMES in tool definitions Alex Riesen
@ 2016-06-28  8:59 ` Alex Riesen
  2016-10-03 10:02   ` Pat Thoyts
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Riesen @ 2016-06-28  8:59 UTC (permalink / raw)
  To: git; +Cc: Pat Thoyts, Junio C Hamano, Jakub Narębski,
	Johannes Schindelin

It is very confusing that the file which diff is displayed is marked as
selected, but it is not in fact selected (that means the array of selected
files does not include the file in question).

Fixing this also improves the use of $FILENAMES in custom defined tools: one
does not have to click the file in the list to make it selected.

Signed-off-by: Alex Riesen <alexander.riesen@cetitec.com>
---
 lib/diff.tcl | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/diff.tcl b/lib/diff.tcl
index 0d56986..30bdd69 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -127,6 +127,9 @@ proc show_diff {path w {lno {}} {scroll_pos {}} {callback {}}} {
 	} else {
 		start_show_diff $cont_info
 	}
+
+	global current_diff_path selected_paths
+	set selected_paths($current_diff_path) 1
 }
 
 proc show_unmerged_diff {cont_info} {
-- 
2.9.0.45.g28c608e.dirty


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] git-gui: ensure the file in the diff pane is in the list of selected files
  2016-06-28  8:59 ` [PATCH 2/2] git-gui: ensure the file in the diff pane is in the list of selected files Alex Riesen
@ 2016-10-03 10:02   ` Pat Thoyts
  0 siblings, 0 replies; 3+ messages in thread
From: Pat Thoyts @ 2016-10-03 10:02 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git, Junio C Hamano, Jakub Narębski, Johannes Schindelin

Alex Riesen <alexander.riesen@cetitec.com> writes:

>It is very confusing that the file which diff is displayed is marked as
>selected, but it is not in fact selected (that means the array of selected
>files does not include the file in question).
>
>Fixing this also improves the use of $FILENAMES in custom defined tools: one
>does not have to click the file in the list to make it selected.
>
>Signed-off-by: Alex Riesen <alexander.riesen@cetitec.com>
>---
> lib/diff.tcl | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/lib/diff.tcl b/lib/diff.tcl
>index 0d56986..30bdd69 100644
>--- a/lib/diff.tcl
>+++ b/lib/diff.tcl
>@@ -127,6 +127,9 @@ proc show_diff {path w {lno {}} {scroll_pos {}} {callback {}}} {
> 	} else {
> 		start_show_diff $cont_info
> 	}
>+
>+	global current_diff_path selected_paths
>+	set selected_paths($current_diff_path) 1
> }
> 
> proc show_unmerged_diff {cont_info} {

These both look good. Applied with minor changes to the commit message
for patch 1.

Thank you,

-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-03 10:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-28  8:57 [PATCH 1/2] git-gui: support for $FILENAMES in tool definitions Alex Riesen
2016-06-28  8:59 ` [PATCH 2/2] git-gui: ensure the file in the diff pane is in the list of selected files Alex Riesen
2016-10-03 10:02   ` Pat Thoyts

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).