Is this possible in any way? I have tried git config --global alias.diff 'diff -b -w' but unfortunately that was not the solution.
- And why wasn't it the solution? (as illustrated by stackoverflow.com/questions/2500586/…). Because setting a flag by default still doesn't seem to be possible: stackoverflow.com/questions/1278296/…VonC– VonC2011-11-22 12:36:38 +00:00Commented Nov 22, 2011 at 12:36
- It did not work, as in it did not affect the behavior of gitk in the way it does the diff.prusswan– prusswan2011-11-23 02:33:31 +00:00Commented Nov 23, 2011 at 2:33
- Ok. I didn't see the "gitk" in the title there.VonC– VonC2011-11-23 04:54:01 +00:00Commented Nov 23, 2011 at 4:54
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 1 Comment
~/.config/git/gitk has the desired effect on startup, it will be removed again on closing gitk. In ~/.gitk it has no effect. I guess this only works for options listed as config_variables. So one would have to add it, as done in this answer.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 5 Comments
savestuff function recreates it afresh each time you exit the application so your added line will get removed unless you modify the function as shown.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.