gitk: remove code targeting git <= 1.7.2
gitk has a few code fragments that are used only for git versions <= 1.7.2 that do not support submodules, notes, word differences, or textconv filters. We just set the minimum git version higher than 1.7.2 so these code fragments have no effect. Delete them. Helped-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Mark Levedahl committed
Jun 5, 2025 at 17:18 UTC
51c543cb5ce1b4a6d60ab68d12822d55010fcd2a
1 file changed
+14
-43
gitk
+14
-43
@@ -361,7 +361,7 @@ proc unmerged_files {files} {
361
proc parseviewargs {n arglist} {
362
global vdatemode vmergeonly vflags vdflags vrevs vfiltered vorigargs env
363
global vinlinediff
364
- global worddiff git_version
364
+ global worddiff
365
366
set vdatemode($n) 0
367
set vmergeonly($n) 0
@@ -412,14 +412,10 @@ proc parseviewargs {n arglist} {
412
"--color-words*" - "--word-diff=color" {
413
# These trigger a word diff in the console interface,
414
# so help the user by enabling our own support
415
- if {[package vcompare $git_version "1.7.2"] >= 0} {
416
- set worddiff [mc "Color words"]
417
- }
415
+ set worddiff [mc "Color words"]
416
}
417
"--word-diff*" {
420
- if {[package vcompare $git_version "1.7.2"] >= 0} {
421
- set worddiff [mc "Markup words"]
422
- }
418
+ set worddiff [mc "Markup words"]
419
}
420
"--stat=*" - "--numstat" - "--shortstat" - "--summary" -
421
"--check" - "--exit-code" - "--quiet" - "--topo-order" -
@@ -567,7 +563,6 @@ proc start_rev_list {view} {
563
global viewactive viewinstances vmergeonly
564
global mainheadid viewmainheadid viewmainheadid_orig
565
global vcanopt vflags vrevs vorigargs
570
- global show_notes
566
567
set startmsecs [clock clicks -milliseconds]
568
set commitidx($view) 0
@@ -617,7 +612,7 @@ proc start_rev_list {view} {
612
}
613
614
if {[catch {
620
- set fd [safe_open_command_redirect [concat git log --no-color -z --pretty=raw $show_notes \
615
+ set fd [safe_open_command_redirect [concat git log --no-color -z --pretty=raw --show-notes \
616
--parents --boundary $args --stdin] \
617
[list "<<[join [concat $revs "--" $files] "\n"]"]]
618
} err]} {
@@ -713,7 +708,6 @@ proc updatecommits {} {
708
global mainheadid viewmainheadid viewmainheadid_orig pending_select
709
global hasworktree
710
global varcid vposids vnegids vflags vrevs
716
- global show_notes
711
712
set hasworktree [hasworktree]
713
rereadrefs
@@ -770,7 +764,7 @@ proc updatecommits {} {
764
set args $vorigargs($view)
765
}
766
if {[catch {
773
- set fd [safe_open_command_redirect [concat git log --no-color -z --pretty=raw $show_notes \
767
+ set fd [safe_open_command_redirect [concat git log --no-color -z --pretty=raw --show-notes \
768
--parents --boundary $args --stdin] \
769
[list "<<[join [concat $revs "--" $vfilelimit($view)] "\n"]"]]
770
} err]} {
@@ -2296,7 +2290,6 @@ proc makewindow {} {
2290
global fprogitem fprogcoord lastprogupdate progupdatepending
2291
global rprogitem rprogcoord rownumsel numcommits
2292
global have_tk85 have_tk86 use_ttk NS
2299
- global git_version
2293
global worddiff
2294
2295
# The "mc" arguments here are purely so that xgettext
@@ -2617,12 +2610,10 @@ proc makewindow {} {
2610
pack .bleft.mid.ignspace -side left -padx 5
2611
2612
set worddiff [mc "Line diff"]
2620
- if {[package vcompare $git_version "1.7.2"] >= 0} {
2621
- makedroplist .bleft.mid.worddiff worddiff [mc "Line diff"] \
2622
- [mc "Markup words"] [mc "Color words"]
2623
- trace add variable worddiff write changeworddiff
2624
- pack .bleft.mid.worddiff -side left -padx 5
2625
- }
2613
+ makedroplist .bleft.mid.worddiff worddiff [mc "Line diff"] \
2614
+ [mc "Markup words"] [mc "Color words"]
2615
+ trace add variable worddiff write changeworddiff
2616
+ pack .bleft.mid.worddiff -side left -padx 5
2617
2618
set ctext .bleft.bottom.ctext
2619
text $ctext -background $bgcolor -foreground $fgcolor \
@@ -5539,15 +5530,11 @@ proc dohidelocalchanges {} {
5530
# spawn off a process to do git diff-index --cached HEAD
5531
proc dodiffindex {} {
5532
global lserial showlocalchanges vfilelimit curview
5542
- global hasworktree git_version
5533
+ global hasworktree
5534
5535
if {!$showlocalchanges || !$hasworktree} return
5536
incr lserial
5546
- if {[package vcompare $git_version "1.7.2"] >= 0} {
5547
- set cmd "git diff-index --cached --ignore-submodules=dirty HEAD"
5548
- } else {
5549
- set cmd "git diff-index --cached HEAD"
5550
- }
5537
+ set cmd "git diff-index --cached --ignore-submodules=dirty HEAD"
5538
if {$vfilelimit($curview) ne {}} {
5539
set cmd [concat $cmd -- $vfilelimit($curview)]
5540
}
@@ -8095,7 +8082,7 @@ proc addtocflist {ids} {
8082
}
8083
8084
proc diffcmd {ids flags} {
8098
- global log_showroot nullid nullid2 git_version
8085
+ global log_showroot nullid nullid2
8086
8087
set i [lsearch -exact $ids $nullid]
8088
set j [lsearch -exact $ids $nullid2]
@@ -8116,9 +8103,7 @@ proc diffcmd {ids flags} {
8103
}
8104
}
8105
} elseif {$j >= 0} {
8119
- if {[package vcompare $git_version "1.7.2"] >= 0} {
8120
- set flags "$flags --ignore-submodules=dirty"
8121
- }
8106
+ set flags "$flags --ignore-submodules=dirty"
8107
set cmd [concat git diff-index --cached $flags]
8108
if {[llength $ids] > 1} {
8109
# comparing index with specific revision
@@ -8247,17 +8232,8 @@ proc getblobdiffs {ids} {
8232
global ignorespace
8233
global worddiff
8234
global limitdiffs vfilelimit curview
8250
- global git_version
8235
8252
- set textconv {}
8253
- if {[package vcompare $git_version "1.6.1"] >= 0} {
8254
- set textconv "--textconv"
8255
- }
8256
- set submodule {}
8257
- if {[package vcompare $git_version "1.6.6"] >= 0} {
8258
- set submodule "--submodule"
8259
- }
8260
- set cmd [diffcmd $ids "-p $textconv $submodule -C --cc --no-commit-id -U$diffcontext"]
8236
+ set cmd [diffcmd $ids "-p --textconv --submodule -C --cc --no-commit-id -U$diffcontext"]
8237
if {$ignorespace} {
8238
append cmd " -w"
8239
}
@@ -12836,11 +12812,6 @@ if {$use_ttk} {
12812
setttkstyle
12813
}
12814
12839
-set show_notes {}
12840
-if {[package vcompare $git_version "1.6.6.2"] >= 0} {
12841
- set show_notes "--show-notes"
12842
-}
12843
-
12815
set appname "gitk"
12816
12817
set runq {}