summaryrefslogtreecommitdiff
path: root/git-gui.sh
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 /git-gui.sh
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 'git-gui.sh')
-rwxr-xr-xgit-gui.sh28
1 files changed, 27 insertions, 1 deletions
diff --git a/git-gui.sh b/git-gui.sh
index ed8bbe1..88b3f8a 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -269,6 +269,17 @@ proc is_config_true {name} {
}
}
+proc is_config_false {name} {
+ global repo_config
+ if {[catch {set v $repo_config($name)}]} {
+ return 0
+ } elseif {$v eq {false} || $v eq {0} || $v eq {no}} {
+ return 1
+ } else {
+ return 0
+ }
+}
+
proc get_config {name} {
global repo_config
if {[catch {set v $repo_config($name)}]} {
@@ -785,6 +796,7 @@ set default_config(user.email) {}
set default_config(gui.encoding) [encoding system]
set default_config(gui.matchtrackingbranch) false
+set default_config(gui.textconv) true
set default_config(gui.pruneduringfetch) false
set default_config(gui.trustmtime) false
set default_config(gui.fastcopyblame) false
@@ -3411,6 +3423,19 @@ lappend diff_actions [list $ctxmsm entryconf [$ctxmsm index last] -state]
$ctxmsm add separator
create_common_diff_popup $ctxmsm
+proc has_textconv {path} {
+ if {[is_config_false gui.textconv]} {
+ return 0
+ }
+ set filter [gitattr $path diff set]
+ set textconv [get_config [join [list diff $filter textconv] .]]
+ if {$filter ne {set} && $textconv ne {}} {
+ return 1
+ } else {
+ return 0
+ }
+}
+
proc popup_diff_menu {ctxm ctxmmg ctxmsm x y X Y} {
global current_diff_path file_states
set ::cursorX $x
@@ -3446,7 +3471,8 @@ proc popup_diff_menu {ctxm ctxmmg ctxmsm x y X Y} {
|| {__} eq $state
|| {_O} eq $state
|| {_T} eq $state
- || {T_} eq $state} {
+ || {T_} eq $state
+ || [has_textconv $current_diff_path]} {
set s disabled
} else {
set s normal