Skip to content

Commit b9b8600

Browse files
sprohaskapaulusmack
authored andcommitted
[PATCH] gitk: Add checkbutton to ignore space changes
Ignoring space changes can be helpful. For example, a commit claims to only reformat source code and you quickly want to verify if this claim is true. Or a commit accidentally changes code formatting and you want to focus on the real changes. In such cases a button to toggle of whitespace changes would be quite handy. You could quickly toggle between seeing and ignoring whitespace changes. This commit adds such a checkbutton right above the diff view. However, in general it is a good thing to see whitespace changes and therefore the state of the checkbutton is not saved. For example, space changes might happen unintentionally. But they are real changes yielding different sha1s for the blobs involved. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
1 parent 3d2c998 commit b9b8600

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

gitk

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ proc makewindow {} {
632632
global findtype findtypemenu findloc findstring fstring geometry
633633
global entries sha1entry sha1string sha1but
634634
global diffcontextstring diffcontext
635+
global ignorespace
635636
global maincursor textcursor curtextcursor
636637
global rowctxmenu fakerowmenu mergemax wrapcomment
637638
global highlight_files gdttype
@@ -849,6 +850,9 @@ proc makewindow {} {
849850
trace add variable diffcontextstring write diffcontextchange
850851
lappend entries .bleft.mid.diffcontext
851852
pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left
853+
checkbutton .bleft.mid.ignspace -text [mc "Ignore space change"] \
854+
-command changeignorespace -variable ignorespace
855+
pack .bleft.mid.ignspace -side left -padx 5
852856
set ctext .bleft.ctext
853857
text $ctext -background $bgcolor -foreground $fgcolor \
854858
-state disabled -font textfont \
@@ -5270,13 +5274,21 @@ proc diffcontextchange {n1 n2 op} {
52705274
}
52715275
}
52725276

5277+
proc changeignorespace {} {
5278+
reselectline
5279+
}
5280+
52735281
proc getblobdiffs {ids} {
52745282
global blobdifffd diffids env
52755283
global diffinhdr treediffs
52765284
global diffcontext
5285+
global ignorespace
52775286
global limitdiffs viewfiles curview
52785287

52795288
set cmd [diffcmd $ids "-p -C --no-commit-id -U$diffcontext"]
5289+
if {$ignorespace} {
5290+
append cmd " -w"
5291+
}
52805292
if {$limitdiffs && $viewfiles($curview) ne {}} {
52815293
set cmd [concat $cmd -- $viewfiles($curview)]
52825294
}
@@ -8459,6 +8471,7 @@ set bgcolor white
84598471
set fgcolor black
84608472
set diffcolors {red "#00a000" blue}
84618473
set diffcontext 3
8474+
set ignorespace 0
84628475
set selectbgcolor gray85
84638476

84648477
## For msgcat loading, first locate the installation location.

0 commit comments

Comments
 (0)