2011-11-22 43 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