Skip to content

Commit a813873

Browse files
committed
gitk: Check git version before using --textconv flag
Commit 785b7535 ("gitk: use --textconv to generate diff text") added the --textconv flag to the git diff commands used to display commit diffs. Since some people use newer gitk with older git installations, this adds a check on the git version to check that it understands --textconv before using it. Signed-off-by: Paul Mackerras <[email protected]>
1 parent b5cda49 commit a813873

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

gitk

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7267,8 +7267,13 @@ proc getblobdiffs {ids} {
72677267
global ignorespace
72687268
global limitdiffs vfilelimit curview
72697269
global diffencoding targetline diffnparents
7270+
global git_version
72707271

7271-
set cmd [diffcmd $ids "-p --textconv -C --cc --no-commit-id -U$diffcontext"]
7272+
set textconv {}
7273+
if {[package vcompare $git_version "1.6.1"] >= 0} {
7274+
set textconv "--textconv"
7275+
}
7276+
set cmd [diffcmd $ids "-p $textconv -C --cc --no-commit-id -U$diffcontext"]
72727277
if {$ignorespace} {
72737278
append cmd " -w"
72747279
}
@@ -11090,6 +11095,7 @@ set nullid2 "0000000000000000000000000000000000000001"
1109011095
set nullfile "/dev/null"
1109111096

1109211097
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
11098+
set git_version [lindex [exec git version] end]
1109311099

1109411100
set runq {}
1109511101
set history {}

0 commit comments

Comments
 (0)