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>
Shawn O. Pearce committed
Nov 12, 2006 at 18:51 UTC
fd2656fdfe575b55424b672f8bc274bf86526b9e
1 file changed
+11
-4
git-gui
+11
-4
@@ -488,7 +488,7 @@ prevent possible confusion.
488
489
proc show_diff {path {w {}} {lno {}}} {
490
global file_states file_lists
491
- global PARENT diff_3way diff_active
491
+ global PARENT diff_3way diff_active repo_config
492
global ui_diff ui_fname_value ui_fstatus_value ui_status_value
493
494
if {$diff_active || ![lock_index read]} return
@@ -515,10 +515,13 @@ proc show_diff {path {w {}} {lno {}}} {
515
set ui_fstatus_value [mapdesc $m $path]
516
set ui_status_value "Loading diff of [escape_path $path]..."
517
518
- set cmd [list | git diff-index -p $PARENT -- $path]
518
+ set cmd [list | git diff-index]
519
+ lappend cmd --no-color
520
+ lappend cmd -p
521
+
522
switch $m {
523
MM {
521
- set cmd [list | git diff-index -p -c $PARENT $path]
524
+ lappend cmd -c
525
}
526
_O {
527
if {[catch {
@@ -542,6 +545,10 @@ proc show_diff {path {w {}} {lno {}}} {
545
}
546
}
547
548
+ lappend cmd $PARENT
549
+ lappend cmd --
550
+ lappend cmd $path
551
+
552
if {[catch {set fd [open $cmd r]} err]} {
553
set diff_active 0
554
unlock_index
@@ -1178,7 +1185,7 @@ proc write_update_index {fd pathList totalCnt batch} {
1185
close $fd
1186
unlock_index
1187
if {$update_index_rsd} {
1181
- show_diff $ui_fname_value
1188
+ reshow_diff
1189
} else {
1190
set ui_status_value {Ready.}
1191
}