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 <paulus@samba.org>
Paul Mackerras committed
May 16, 2009 at 21:06 UTC
a8138733fcf4d9c175b53ab0d0f06a3f7c232286
1 file changed
+7
-1
gitk
+7
-1
@@ -7267,8 +7267,13 @@ proc getblobdiffs {ids} {
7267
global ignorespace
7268
global limitdiffs vfilelimit curview
7269
global diffencoding targetline diffnparents
7270
+ global git_version
7271
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"]
7277
if {$ignorespace} {
7278
append cmd " -w"
7279
}
@@ -11090,6 +11095,7 @@ set nullid2 "0000000000000000000000000000000000000001"
11095
set nullfile "/dev/null"
11096
11097
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
11098
+set git_version [lindex [exec git version] end]
11099
11100
set runq {}
11101
set history {}