@matheusbsbs / matheus-bagliano / commits / b9b86007e2
Fork 0

[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>

Steffen Prohaska committed Jan 17, 2008 at 23:42 UTC b9b86007e27d9a06d58feab618a5be1d491ed13e
1 file changed +13
gitk
+13
@@ -632,6 +632,7 @@ proc makewindow {} {
632 global findtype findtypemenu findloc findstring fstring geometry
633 global entries sha1entry sha1string sha1but
634 global diffcontextstring diffcontext
635 + global ignorespace
636 global maincursor textcursor curtextcursor
637 global rowctxmenu fakerowmenu mergemax wrapcomment
638 global highlight_files gdttype
@@ -849,6 +850,9 @@ proc makewindow {} {
850 trace add variable diffcontextstring write diffcontextchange
851 lappend entries .bleft.mid.diffcontext
852 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
856 set ctext .bleft.ctext
857 text $ctext -background $bgcolor -foreground $fgcolor \
858 -state disabled -font textfont \
@@ -5270,13 +5274,21 @@ proc diffcontextchange {n1 n2 op} {
5274 }
5275 }
5276
5277 +proc changeignorespace {} {
5278 + reselectline
5279 +}
5280 +
5281 proc getblobdiffs {ids} {
5282 global blobdifffd diffids env
5283 global diffinhdr treediffs
5284 global diffcontext
5285 + global ignorespace
5286 global limitdiffs viewfiles curview
5287
5288 set cmd [diffcmd $ids "-p -C --no-commit-id -U$diffcontext"]
5289 + if {$ignorespace} {
5290 + append cmd " -w"
5291 + }
5292 if {$limitdiffs && $viewfiles($curview) ne {}} {
5293 set cmd [concat $cmd -- $viewfiles($curview)]
5294 }
@@ -8459,6 +8471,7 @@ set bgcolor white
8471 set fgcolor black
8472 set diffcolors {red "#00a000" blue}
8473 set diffcontext 3
8474 +set ignorespace 0
8475 set selectbgcolor gray85
8476
8477 ## For msgcat loading, first locate the installation location.