2011-11-22 41 views
8

这有可能以任何方式吗?我试过git config --global alias.diff 'diff -b -w',但不幸的是,这不是解决方案。Gitk:默认设置为“忽略空间更改”选项为

+0

为什么不是解决方案? (如http://stackoverflow.com/questions/2500586/setting-git-default-flags-on-commands所示)。因为默认情况下设置标志仍然不可能:http://stackoverflow.com/questions/1278296/is-there-any-way-to-set-a-flag-by-default-for-a -git-command – VonC

+0

它不起作用,因为它不会影响gitk在diff中的行为。 – prusswan

+0

好的。我没有看到标题中的“gitk”。 – VonC

回答

5

这里真正需要的是在UI上保持由checkbutton设置的变量的值。以下补丁实现了这一点。或者你可以强制默认值在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 
+0

为此提供了一个补丁,但我不太可能去gitk的自定义构建的问题 – prusswan

+0

它是一个单一的文件脚本 - 你可以编辑/ usr/local/bin/gitk或无论它在哪里。 – patthoyts

+0

如果git包被更新,它会被覆盖吗? – prusswan

6

这有点旧,但我发现这个问题在前一天使用Google搜索,已经接受的答案给了我一个如何去做的暗示。

无需修改gitk本身:只需编辑您的.gitk文件(〜/的.config /混帐/ gitk或〜/ .gitk)并添加:

set ignorespace 1