Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitk: Setting "Ignore space change" option to be true by default

Is this possible in any way? I have tried git config --global alias.diff 'diff -b -w' but unfortunately that was not the solution.

like image 755
prusswan Avatar asked Nov 22 '11 04:11

prusswan


3 Answers

It's a bit old but I found that question the other day googling, and the already accepted answer gave me a hint of how to do it.

No need to modify gitk itself: just edit your .gitk file (~/.config/git/gitk or ~/.gitk) and add:

set ignorespace 1
like image 72
Vincent Isambart Avatar answered Nov 09 '22 06:11

Vincent Isambart


All that is really required here is to persist the value of the variable set by the checkbutton on the UI. The following patch achieves this. Or you could just force the default to be true at line 11475 (set ignorespace 1).

From 54f9e800fe28cd6d5d0d44d4e2e561263cbf3407 Mon Sep 17 00:00:00 2001
From: Pat Thoyts <[email protected]>
Date: Tue, 13 Dec 2011 11:39:01 +0000
Subject: [PATCH] gitk: persist the value of the ignorespace setting for
 diffs.

Signed-off-by: Pat Thoyts <[email protected]>
---
 gitk-git/gitk |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 2a92e20..29b18d9 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -2653,7 +2653,7 @@ proc savestuff {w} {
     global cmitmode wrapcomment datetimeformat limitdiffs
     global colors uicolor bgcolor fgcolor diffcolors diffcontext selectbgcolor
     global autoselect autosellen extdifftool perfile_attrs markbgcolor use_ttk
-    global hideremotes want_ttk
+    global hideremotes want_ttk ignorespace

     if {$stuffsaved} return
     if {![winfo viewable .]} return
@@ -2690,6 +2690,7 @@ proc savestuff {w} {
        puts $f [list set selectbgcolor $selectbgcolor]
        puts $f [list set extdifftool $extdifftool]
        puts $f [list set perfile_attrs $perfile_attrs]
+       puts $f [list set ignorespace $ignorespace]

        puts $f "set geometry(main) [wm geometry .]"
        puts $f "set geometry(state) [wm state .]"
--
1.7.8.msysgit.0
like image 5
patthoyts Avatar answered Nov 09 '22 07:11

patthoyts


Note: Now (after Sept 2014) update gitk config_variables and add ignorespace

https://github.com/git/git/commit/9fabefb1f3f658e77eb18afa3f95efe1a0ee8d0d

All these are flushed to .gitk file.

like image 4
topolik Avatar answered Nov 09 '22 08:11

topolik