Skip to content

Commit 51c543c

Browse files
committed
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 <[email protected]> Signed-off-by: Mark Levedahl <[email protected]>
1 parent 8f49975 commit 51c543c

File tree

1 file changed

+14
-43
lines changed

1 file changed

+14
-43
lines changed

gitk

Lines changed: 14 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ proc unmerged_files {files} {
361361
proc parseviewargs {n arglist} {
362362
global vdatemode vmergeonly vflags vdflags vrevs vfiltered vorigargs env
363363
global vinlinediff
364-
global worddiff git_version
364+
global worddiff
365365
366366
set vdatemode($n) 0
367367
set vmergeonly($n) 0
@@ -412,14 +412,10 @@ proc parseviewargs {n arglist} {
412412
"--color-words*" - "--word-diff=color" {
413413
# These trigger a word diff in the console interface,
414414
# 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"]
418416
}
419417
"--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"]
423419
}
424420
"--stat=*" - "--numstat" - "--shortstat" - "--summary" -
425421
"--check" - "--exit-code" - "--quiet" - "--topo-order" -
@@ -567,7 +563,6 @@ proc start_rev_list {view} {
567563
global viewactive viewinstances vmergeonly
568564
global mainheadid viewmainheadid viewmainheadid_orig
569565
global vcanopt vflags vrevs vorigargs
570-
global show_notes
571566
572567
set startmsecs [clock clicks -milliseconds]
573568
set commitidx($view) 0
@@ -617,7 +612,7 @@ proc start_rev_list {view} {
617612
}
618613
619614
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 \
621616
--parents --boundary $args --stdin] \
622617
[list "<<[join [concat $revs "--" $files] "\n"]"]]
623618
} err]} {
@@ -713,7 +708,6 @@ proc updatecommits {} {
713708
global mainheadid viewmainheadid viewmainheadid_orig pending_select
714709
global hasworktree
715710
global varcid vposids vnegids vflags vrevs
716-
global show_notes
717711
718712
set hasworktree [hasworktree]
719713
rereadrefs
@@ -770,7 +764,7 @@ proc updatecommits {} {
770764
set args $vorigargs($view)
771765
}
772766
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 \
774768
--parents --boundary $args --stdin] \
775769
[list "<<[join [concat $revs "--" $vfilelimit($view)] "\n"]"]]
776770
} err]} {
@@ -2296,7 +2290,6 @@ proc makewindow {} {
22962290
global fprogitem fprogcoord lastprogupdate progupdatepending
22972291
global rprogitem rprogcoord rownumsel numcommits
22982292
global have_tk85 have_tk86 use_ttk NS
2299-
global git_version
23002293
global worddiff
23012294
23022295
# The "mc" arguments here are purely so that xgettext
@@ -2617,12 +2610,10 @@ proc makewindow {} {
26172610
pack .bleft.mid.ignspace -side left -padx 5
26182611
26192612
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
26262617
26272618
set ctext .bleft.bottom.ctext
26282619
text $ctext -background $bgcolor -foreground $fgcolor \
@@ -5539,15 +5530,11 @@ proc dohidelocalchanges {} {
55395530
# spawn off a process to do git diff-index --cached HEAD
55405531
proc dodiffindex {} {
55415532
global lserial showlocalchanges vfilelimit curview
5542-
global hasworktree git_version
5533+
global hasworktree
55435534
55445535
if {!$showlocalchanges || !$hasworktree} return
55455536
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"
55515538
if {$vfilelimit($curview) ne {}} {
55525539
set cmd [concat $cmd -- $vfilelimit($curview)]
55535540
}
@@ -8095,7 +8082,7 @@ proc addtocflist {ids} {
80958082
}
80968083
80978084
proc diffcmd {ids flags} {
8098-
global log_showroot nullid nullid2 git_version
8085+
global log_showroot nullid nullid2
80998086
81008087
set i [lsearch -exact $ids $nullid]
81018088
set j [lsearch -exact $ids $nullid2]
@@ -8116,9 +8103,7 @@ proc diffcmd {ids flags} {
81168103
}
81178104
}
81188105
} 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"
81228107
set cmd [concat git diff-index --cached $flags]
81238108
if {[llength $ids] > 1} {
81248109
# comparing index with specific revision
@@ -8247,17 +8232,8 @@ proc getblobdiffs {ids} {
82478232
global ignorespace
82488233
global worddiff
82498234
global limitdiffs vfilelimit curview
8250-
global git_version
82518235
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"]
82618237
if {$ignorespace} {
82628238
append cmd " -w"
82638239
}
@@ -12836,11 +12812,6 @@ if {$use_ttk} {
1283612812
setttkstyle
1283712813
}
1283812814
12839-
set show_notes {}
12840-
if {[package vcompare $git_version "1.6.6.2"] >= 0} {
12841-
set show_notes "--show-notes"
12842-
}
12843-
1284412815
set appname "gitk"
1284512816
1284612817
set runq {}

0 commit comments

Comments
 (0)