summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorClément Poulain <clement.poulain@ensimag.imag.fr>2010-07-30 08:11:02 (GMT)
committerPat Thoyts <patthoyts@users.sourceforge.net>2010-07-30 09:05:27 (GMT)
commit1fbaccad4dd8d6a9a893843c73f3e47c4ba8b717 (patch)
tree041d322979a5321834633c771414b52e618e12b9 /lib
parent85123549f005ebdfb55a5cbd738c3237aaed6eff (diff)
downloadgit-1fbaccad4dd8d6a9a893843c73f3e47c4ba8b717.zip
git-1fbaccad4dd8d6a9a893843c73f3e47c4ba8b717.tar.gz
git-1fbaccad4dd8d6a9a893843c73f3e47c4ba8b717.tar.bz2
git-gui: use textconv filter for diff and blame
Create a checkbox "Use Textconv For Diffs and Blame" in git-gui options. If checked and if the driver for the concerned file exists, git-gui calls diff and blame with --textconv option Signed-off-by: Clément Poulain <clement.poulain@ensimag.imag.fr> Signed-off-by: Diane Gasselin <diane.gasselin@ensimag.imag.fr> Signed-off-by: Axel Bonnet <axel.bonnet@ensimag.imag.fr> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/blame.tcl21
-rw-r--r--lib/diff.tcl5
-rw-r--r--lib/option.tcl1
3 files changed, 24 insertions, 3 deletions
diff --git a/lib/blame.tcl b/lib/blame.tcl
index 786b50b..2137ec9 100644
--- a/lib/blame.tcl
+++ b/lib/blame.tcl
@@ -449,11 +449,28 @@ method _load {jump} {
$status show [mc "Reading %s..." "$commit:[escape_path $path]"]
$w_path conf -text [escape_path $path]
+
+ set do_textconv 0
+ if {![is_config_false gui.textconv] && [git-version >= 1.7.2]} {
+ set filter [gitattr $path diff set]
+ set textconv [get_config [join [list diff $filter textconv] .]]
+ if {$filter ne {set} && $textconv ne {}} {
+ set do_textconv 1
+ }
+ }
if {$commit eq {}} {
- set fd [open $path r]
+ if {$do_textconv ne 0} {
+ set fd [open |[list $textconv $path] r]
+ } else {
+ set fd [open $path r]
+ }
fconfigure $fd -eofchar {}
} else {
- set fd [git_read cat-file blob "$commit:$path"]
+ if {$do_textconv ne 0} {
+ set fd [git_read cat-file --textconv "$commit:$path"]
+ } else {
+ set fd [git_read cat-file blob "$commit:$path"]
+ }
}
fconfigure $fd \
-blocking 0 \
diff --git a/lib/diff.tcl b/lib/diff.tcl
index ec8c11e..c628750 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -55,7 +55,7 @@ proc handle_empty_diff {} {
set path $current_diff_path
set s $file_states($path)
- if {[lindex $s 0] ne {_M}} return
+ if {[lindex $s 0] ne {_M} || [has_textconv $path]} return
# Prevent infinite rescan loops
incr diff_empty_count
@@ -280,6 +280,9 @@ proc start_show_diff {cont_info {add_opts {}}} {
lappend cmd diff-files
}
}
+ if {![is_config_false gui.textconv] && [git-version >= 1.6.1]} {
+ lappend cmd --textconv
+ }
if {[string match {160000 *} [lindex $s 2]]
|| [string match {160000 *} [lindex $s 3]]} {
diff --git a/lib/option.tcl b/lib/option.tcl
index d4c5e45..3807c8d 100644
--- a/lib/option.tcl
+++ b/lib/option.tcl
@@ -148,6 +148,7 @@ proc do_options {} {
{b gui.trustmtime {mc "Trust File Modification Timestamps"}}
{b gui.pruneduringfetch {mc "Prune Tracking Branches During Fetch"}}
{b gui.matchtrackingbranch {mc "Match Tracking Branches"}}
+ {b gui.textconv {mc "Use Textconv For Diffs and Blames"}}
{b gui.fastcopyblame {mc "Blame Copy Only On Changed Files"}}
{i-20..200 gui.copyblamethreshold {mc "Minimum Letters To Blame Copy On"}}
{i-0..300 gui.blamehistoryctx {mc "Blame History Context Radius (days)"}}