summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2006-11-12 18:51:38 -0500
committerShawn O. Pearce <spearce@spearce.org>2006-11-13 00:10:39 -0500
commitfd2656fdfe575b55424b672f8bc274bf86526b9e (patch)
treeeb0ea99dbdcaeabe6fabeb67cb428d282f68d4a4
parent2cbe5577a0e83ae7368eb2202ffe62c1d607b0bb (diff)
downloadgit-fd2656fdfe575b55424b672f8bc274bf86526b9e.tar.gz
git-gui: Cleanup diff construction code to prepare for more options.
I'd like to allow the user to have more control over how we format the diff in the diff viewer; to that end we need to add additional options to the diff-index command line as we construct the command for execution. So cleanup the command handling code now to use lappend so we can come back and add in our additional options. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rwxr-xr-xgit-gui15
1 files changed, 11 insertions, 4 deletions
diff --git a/git-gui b/git-gui
index fdb82812bd..ea71526e60 100755
--- a/git-gui
+++ b/git-gui
@@ -488,7 +488,7 @@ prevent possible confusion.
proc show_diff {path {w {}} {lno {}}} {
global file_states file_lists
- global PARENT diff_3way diff_active
+ global PARENT diff_3way diff_active repo_config
global ui_diff ui_fname_value ui_fstatus_value ui_status_value
if {$diff_active || ![lock_index read]} return
@@ -515,10 +515,13 @@ proc show_diff {path {w {}} {lno {}}} {
set ui_fstatus_value [mapdesc $m $path]
set ui_status_value "Loading diff of [escape_path $path]..."
- set cmd [list | git diff-index -p $PARENT -- $path]
+ set cmd [list | git diff-index]
+ lappend cmd --no-color
+ lappend cmd -p
+
switch $m {
MM {
- set cmd [list | git diff-index -p -c $PARENT $path]
+ lappend cmd -c
}
_O {
if {[catch {
@@ -542,6 +545,10 @@ proc show_diff {path {w {}} {lno {}}} {
}
}
+ lappend cmd $PARENT
+ lappend cmd --
+ lappend cmd $path
+
if {[catch {set fd [open $cmd r]} err]} {
set diff_active 0
unlock_index
@@ -1178,7 +1185,7 @@ proc write_update_index {fd pathList totalCnt batch} {
close $fd
unlock_index
if {$update_index_rsd} {
- show_diff $ui_fname_value
+ reshow_diff
} else {
set ui_status_value {Ready.}
}