# [PATCH] git-gui: guitools: add the path in the confirmation dialog for tools which needs one

3 messages from 2011-10-20 to 2011-10-21. Participants: Bert Wesarg, Pat Thoyts, Junio C Hamano.
Thread: https://gitlist.dev/t/28730

## Bert Wesarg, 2011-10-20 19:32

Subject: [PATCH] git-gui: guitools: add the path in the confirmation dialog for tools which needs one
Message-ID: <2fef219736a0787ed864b5c18adf31f7a4e8acda.1319139139.git.bert.wesarg@googlemail.com>
URL: https://gitlist.dev/e/2fef219736a0787ed864b5c18adf31f7a4e8acda.1319139139.git.bert.wesarg%40googlemail.com

```
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
---
 lib/tools.tcl |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/tools.tcl b/lib/tools.tcl
index 95e6e55..39e08f0 100644
--- a/lib/tools.tcl
+++ b/lib/tools.tcl
@@ -87,8 +87,14 @@ proc tools_exec {fullname} {
 			return
 		}
 	} elseif {[is_config_true "guitool.$fullname.confirm"]} {
-		if {[ask_popup [mc "Are you sure you want to run %s?" $fullname]] ne {yes}} {
-			return
+		if {[is_config_true "guitool.$fullname.needsfile"]} {
+			if {[ask_popup [mc "Are you sure you want to run %s on file \"%s\"?" $fullname $current_diff_path]] ne {yes}} {
+				return
+			}
+		} else {
+			if {[ask_popup [mc "Are you sure you want to run %s?" $fullname]] ne {yes}} {
+				return
+			}
 		}
 	}
 
-- 
1.7.7.759.gfc8c6

```

## Pat Thoyts, 2011-10-21 22:19

Subject: Re: [PATCH] git-gui: guitools: add the path in the confirmation dialog for tools which needs one
Message-ID: <87ipni3s3n.fsf@fox.patthoyts.tk>
URL: https://gitlist.dev/e/87ipni3s3n.fsf%40fox.patthoyts.tk
In-Reply-To: <2fef219736a0787ed864b5c18adf31f7a4e8acda.1319139139.git.bert.wesarg@googlemail.com>

```
Bert Wesarg <bert.wesarg@googlemail.com> writes:

>Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
>---
> lib/tools.tcl |   10 ++++++++--
> 1 files changed, 8 insertions(+), 2 deletions(-)
>
>diff --git a/lib/tools.tcl b/lib/tools.tcl
>index 95e6e55..39e08f0 100644
>--- a/lib/tools.tcl
>+++ b/lib/tools.tcl
>@@ -87,8 +87,14 @@ proc tools_exec {fullname} {
> 			return
> 		}
> 	} elseif {[is_config_true "guitool.$fullname.confirm"]} {
>-		if {[ask_popup [mc "Are you sure you want to run %s?" $fullname]] ne {yes}} {
>-			return
>+		if {[is_config_true "guitool.$fullname.needsfile"]} {
>+			if {[ask_popup [mc "Are you sure you want to run %s on file \"%s\"?" $fullname $current_diff_path]] ne {yes}} {
>+				return
>+			}
>+		} else {
>+			if {[ask_popup [mc "Are you sure you want to run %s?" $fullname]] ne {yes}} {
>+				return
>+			}
> 		}
> 	}

This looks good. I modified the string there to use positional
parameters as sometimes translations need to re-order things and the
msgcat format can support this using [mc {%2$s and %1$d} $first $second]
-- 
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD

```

## Junio C Hamano, 2011-10-21 22:43

Subject: Re: [PATCH] git-gui: guitools: add the path in the confirmation dialog for tools which needs one
Message-ID: <7v62ji7yox.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v62ji7yox.fsf%40alter.siamese.dyndns.org
In-Reply-To: <87ipni3s3n.fsf@fox.patthoyts.tk>

```
Pat Thoyts <patthoyts@users.sourceforge.net> writes:

> .... I modified the string there to use positional
> parameters as sometimes translations need to re-order things and the
> msgcat format can support this using [mc {%2$s and %1$d} $first $second]

Good catch.

```
