@matheusbsbs / matheus-bagliano / commits / 55ba8a3474
Fork 0

git gui: show diffs with a minimum of 1 context line

Staging hunks without context does not work, because line number information would have to be recomputed for individual hunks. Since it is already possible to stage individual lines using 'Stage Line for Commit', zero context diffs are not really necessary for git gui. Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Clemens Buchacher committed Aug 30, 2008 at 18:45 UTC 55ba8a3474102eb8d638834d2b9bfe58d5014a40
3 files changed +3 -3
git-gui.sh
+1 -1
@@ -1932,7 +1932,7 @@ proc show_more_context {} {
1932
1933 proc show_less_context {} {
1934 global repo_config
1935 - if {$repo_config(gui.diffcontext) >= 1} {
1935 + if {$repo_config(gui.diffcontext) > 1} {
1936 incr repo_config(gui.diffcontext) -1
1937 reshow_diff
1938 }
lib/diff.tcl
+1 -1
@@ -175,7 +175,7 @@ proc show_diff {path w {lno {}} {scroll_pos {}}} {
175
176 lappend cmd -p
177 lappend cmd --no-color
178 - if {$repo_config(gui.diffcontext) >= 0} {
178 + if {$repo_config(gui.diffcontext) >= 1} {
179 lappend cmd "-U$repo_config(gui.diffcontext)"
180 }
181 if {$w eq $ui_index} {
lib/option.tcl
+1 -1
@@ -125,7 +125,7 @@ proc do_options {} {
125 {b gui.matchtrackingbranch {mc "Match Tracking Branches"}}
126 {b gui.fastcopyblame {mc "Blame Copy Only On Changed Files"}}
127 {i-20..200 gui.copyblamethreshold {mc "Minimum Letters To Blame Copy On"}}
128 - {i-0..99 gui.diffcontext {mc "Number of Diff Context Lines"}}
128 + {i-1..99 gui.diffcontext {mc "Number of Diff Context Lines"}}
129 {i-0..99 gui.commitmsgwidth {mc "Commit Message Text Width"}}
130 {t gui.newbranchtemplate {mc "New Branch Name Template"}}
131 } {