# [PATCH] git-gui: add config value gui.diffopts for passing additional diff options

4 messages from 2011-01-21 to 2011-01-28. Participants: Tilman Vogel, Pat Thoyts, Johannes Sixt.
Thread: https://gitlist.dev/t/26316

## Tilman Vogel, 2011-01-21 10:59

Subject: [PATCH] git-gui: add config value gui.diffopts for passing additional diff options
Message-ID: <1295607585-15971-1-git-send-email-tilman.vogel@web.de>
URL: https://gitlist.dev/e/1295607585-15971-1-git-send-email-tilman.vogel%40web.de

```
Signed-off-by: Tilman Vogel <tilman.vogel@web.de>
---
 Documentation/config.txt |    4 ++++
 git-gui/git-gui.sh       |    1 +
 git-gui/lib/diff.tcl     |    1 +
 git-gui/lib/option.tcl   |    1 +
 4 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index ff7c225..0ed7bcf 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1100,6 +1100,10 @@ gui.diffcontext::
 	Specifies how many context lines should be used in calls to diff
 	made by the linkgit:git-gui[1]. The default is "5".
 
+gui.diffopts::
+	Specifies additional parameters to pass to diff from 
+	linkgit:git-gui[1]. The default is "".
+
 gui.encoding::
 	Specifies the default encoding to use for displaying of
 	file contents in linkgit:git-gui[1] and linkgit:gitk[1].
diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
index d3acf0d..2a3aed5 100755
--- a/git-gui/git-gui.sh
+++ b/git-gui/git-gui.sh
@@ -823,6 +823,7 @@ set default_config(gui.fastcopyblame) false
 set default_config(gui.copyblamethreshold) 40
 set default_config(gui.blamehistoryctx) 7
 set default_config(gui.diffcontext) 5
+set default_config(gui.diffopts) {}
 set default_config(gui.commitmsgwidth) 75
 set default_config(gui.newbranchtemplate) {}
 set default_config(gui.spellingdictionary) {}
diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
index dcf0711..de3827a 100644
--- a/git-gui/lib/diff.tcl
+++ b/git-gui/lib/diff.tcl
@@ -295,6 +295,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
 
 	lappend cmd -p
 	lappend cmd --color
+	set cmd [concat $cmd $repo_config(gui.diffopts)]
 	if {$repo_config(gui.diffcontext) >= 1} {
 		lappend cmd "-U$repo_config(gui.diffcontext)"
 	}
diff --git a/git-gui/lib/option.tcl b/git-gui/lib/option.tcl
index 3807c8d..1e5d28c 100644
--- a/git-gui/lib/option.tcl
+++ b/git-gui/lib/option.tcl
@@ -153,6 +153,7 @@ proc do_options {} {
 		{i-20..200 gui.copyblamethreshold {mc "Minimum Letters To Blame Copy On"}}
 		{i-0..300 gui.blamehistoryctx {mc "Blame History Context Radius (days)"}}
 		{i-1..99 gui.diffcontext {mc "Number of Diff Context Lines"}}
+		{t gui.diffopts {mc "Additional Diff Parameters"}}
 		{i-0..99 gui.commitmsgwidth {mc "Commit Message Text Width"}}
 		{t gui.newbranchtemplate {mc "New Branch Name Template"}}
 		{c gui.encoding {mc "Default File Contents Encoding"}}
-- 
1.7.3.4

```

## Pat Thoyts, 2011-01-25 00:25

Subject: Re: [PATCH] git-gui: add config value gui.diffopts for passing additional diff options
Message-ID: <87ipxdn81f.fsf@fox.patthoyts.tk>
URL: https://gitlist.dev/e/87ipxdn81f.fsf%40fox.patthoyts.tk
In-Reply-To: <1295607585-15971-1-git-send-email-tilman.vogel@web.de>

```
Tilman Vogel <tilman.vogel@web.de> writes:

>Signed-off-by: Tilman Vogel <tilman.vogel@web.de>
>---
> Documentation/config.txt |    4 ++++
> git-gui/git-gui.sh       |    1 +
> git-gui/lib/diff.tcl     |    1 +
> git-gui/lib/option.tcl   |    1 +
> 4 files changed, 7 insertions(+), 0 deletions(-)
>
>diff --git a/Documentation/config.txt b/Documentation/config.txt
>index ff7c225..0ed7bcf 100644
>--- a/Documentation/config.txt
>+++ b/Documentation/config.txt
>@@ -1100,6 +1100,10 @@ gui.diffcontext::
> 	Specifies how many context lines should be used in calls to diff
> 	made by the linkgit:git-gui[1]. The default is "5".
> 
>+gui.diffopts::
>+	Specifies additional parameters to pass to diff from 
>+	linkgit:git-gui[1]. The default is "".
>+
> gui.encoding::
> 	Specifies the default encoding to use for displaying of
> 	file contents in linkgit:git-gui[1] and linkgit:gitk[1].
>diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh
>index d3acf0d..2a3aed5 100755
>--- a/git-gui/git-gui.sh
>+++ b/git-gui/git-gui.sh
>@@ -823,6 +823,7 @@ set default_config(gui.fastcopyblame) false
> set default_config(gui.copyblamethreshold) 40
> set default_config(gui.blamehistoryctx) 7
> set default_config(gui.diffcontext) 5
>+set default_config(gui.diffopts) {}
> set default_config(gui.commitmsgwidth) 75
> set default_config(gui.newbranchtemplate) {}
> set default_config(gui.spellingdictionary) {}
>diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl
>index dcf0711..de3827a 100644
>--- a/git-gui/lib/diff.tcl
>+++ b/git-gui/lib/diff.tcl
>@@ -295,6 +295,7 @@ proc start_show_diff {cont_info {add_opts {}}} {
> 
> 	lappend cmd -p
> 	lappend cmd --color
>+	set cmd [concat $cmd $repo_config(gui.diffopts)]
> 	if {$repo_config(gui.diffcontext) >= 1} {
> 		lappend cmd "-U$repo_config(gui.diffcontext)"
> 	}
>diff --git a/git-gui/lib/option.tcl b/git-gui/lib/option.tcl
>index 3807c8d..1e5d28c 100644
>--- a/git-gui/lib/option.tcl
>+++ b/git-gui/lib/option.tcl
>@@ -153,6 +153,7 @@ proc do_options {} {
> 		{i-20..200 gui.copyblamethreshold {mc "Minimum Letters To Blame Copy On"}}
> 		{i-0..300 gui.blamehistoryctx {mc "Blame History Context Radius (days)"}}
> 		{i-1..99 gui.diffcontext {mc "Number of Diff Context Lines"}}
>+		{t gui.diffopts {mc "Additional Diff Parameters"}}
> 		{i-0..99 gui.commitmsgwidth {mc "Commit Message Text Width"}}
> 		{t gui.newbranchtemplate {mc "New Branch Name Template"}}
> 		{c gui.encoding {mc "Default File Contents Encoding"}}

This seems ok but you don't say what it is for. Why do you want to be
able to pass additional options to git diff?

I can apply this to git-gui's repository. The Documentation change will
need to be sent to git separately once this is merged from git-gui.

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

```

## Tilman Vogel, 2011-01-28 00:19

Subject: Re: [PATCH] git-gui: add config value gui.diffopts for passing additional diff options
Message-ID: <4D420B95.2060509@web.de>
URL: https://gitlist.dev/e/4D420B95.2060509%40web.de
In-Reply-To: <87ipxdn81f.fsf@fox.patthoyts.tk>

```
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

Am 25.01.2011 01:25, schrieb Pat Thoyts:
> This seems ok but you don't say what it is for. Why do you want to be
> able to pass additional options to git diff?

Sorry, forgot to copy the motivation from
<https://github.com/git/git/pull/8>:

I want to be able to make diff ignore whitespace changes "-b". But maybe
someone else wants "-w" or what not, so I think a generic option field
is most versatile.

If you feel, this switch should be easier to reach than through the
options menu, I agree, but I am a Tcl/Tk newbie, so this was the easiest
fix for me.

> I can apply this to git-gui's repository. The Documentation change will
> need to be sent to git separately once this is merged from git-gui.

Sure, I would be happy. However, if you feel like coding up something
that's easier to use, I'd be even happier. But maybe the generic field
is still of use.

Regards,

Tilman

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/

iEYEARECAAYFAk1CC5UACgkQ9ZPu6Yae8lknCwCfcEfBH8uSSZbB93IHpJiEivll
zlwAoKgPswZGMf6fERRB8p24TsLCGA1r
=uWHw
-----END PGP SIGNATURE-----

```

## Johannes Sixt, 2011-01-28 07:29

Subject: Re: [PATCH] git-gui: add config value gui.diffopts for passing additional diff options
Message-ID: <4D42703E.5070202@viscovery.net>
URL: https://gitlist.dev/e/4D42703E.5070202%40viscovery.net
In-Reply-To: <4D420B95.2060509@web.de>

```
Am 1/28/2011 1:19, schrieb Tilman Vogel:
> Am 25.01.2011 01:25, schrieb Pat Thoyts:
>> This seems ok but you don't say what it is for. Why do you want to be
>> able to pass additional options to git diff?
> 
> Sorry, forgot to copy the motivation from
> <https://github.com/git/git/pull/8>:
> 
> I want to be able to make diff ignore whitespace changes "-b". But maybe
> someone else wants "-w" or what not, so I think a generic option field
> is most versatile.

What do you expect to happen, when a user writes any of the following in
that edit box?

  --name-status
  -R
  --frotz
  origin master

Don't you want to diagnose bogus input?
Disable "Stage/Unstage hung/lines" (because they won't apply anymore)?
Etc.

I don't think this is a great improvement. At the least it is not thought
through.

-- Hannes

```
