From mboxrd@z Thu Jan 1 00:00:00 1970 From: Clemens Buchacher Subject: [PATCH] git gui: show diffs with a minimum of 1 context line Date: Sat, 30 Aug 2008 18:45:27 +0200 Message-ID: <20080830164527.GA25370@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: git@vger.kernel.org To: "Shawn O. Pearce" X-From: git-owner@vger.kernel.org Sat Aug 30 18:46:25 2008 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1KZTah-0002Tr-3x for gcvg-git-2@gmane.org; Sat, 30 Aug 2008 18:46:23 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752833AbYH3QpS (ORCPT ); Sat, 30 Aug 2008 12:45:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752710AbYH3QpR (ORCPT ); Sat, 30 Aug 2008 12:45:17 -0400 Received: from postman.fh-hagenberg.at ([193.170.124.96]:20360 "EHLO mail.fh-hagenberg.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752613AbYH3QpQ (ORCPT ); Sat, 30 Aug 2008 12:45:16 -0400 Received: from darc.dyndns.org ([84.154.72.105]) by mail.fh-hagenberg.at over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Sat, 30 Aug 2008 18:45:12 +0200 Received: from drizzd by darc.dyndns.org with local (Exim 4.69) (envelope-from ) id 1KZTZn-0007O6-AR; Sat, 30 Aug 2008 18:45:27 +0200 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-OriginalArrivalTime: 30 Aug 2008 16:45:13.0275 (UTC) FILETIME=[C5F1A8B0:01C90ABF] Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: git apply does not handle diffs without context correctly. Configuring git gui to show zero context lines therefore breaks staging. Signed-off-by: Clemens Buchacher --- In reply to this patch I will send a first attempt at fixing this problem instead of avoiding it. There does not seem to be a straightforward solution, however, so this should hide the bug for now. git-gui/git-gui.sh | 2 +- git-gui/lib/diff.tcl | 2 +- git-gui/lib/option.tcl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh index ad65aaa..86402d4 100755 --- a/git-gui/git-gui.sh +++ b/git-gui/git-gui.sh @@ -1932,7 +1932,7 @@ proc show_more_context {} { proc show_less_context {} { global repo_config - if {$repo_config(gui.diffcontext) >= 1} { + if {$repo_config(gui.diffcontext) > 1} { incr repo_config(gui.diffcontext) -1 reshow_diff } diff --git a/git-gui/lib/diff.tcl b/git-gui/lib/diff.tcl index 52b79e4..4a7138b 100644 --- a/git-gui/lib/diff.tcl +++ b/git-gui/lib/diff.tcl @@ -175,7 +175,7 @@ proc show_diff {path w {lno {}} {scroll_pos {}}} { lappend cmd -p lappend cmd --no-color - if {$repo_config(gui.diffcontext) >= 0} { + if {$repo_config(gui.diffcontext) >= 1} { lappend cmd "-U$repo_config(gui.diffcontext)" } if {$w eq $ui_index} { diff --git a/git-gui/lib/option.tcl b/git-gui/lib/option.tcl index ffb3f00..5e1346e 100644 --- a/git-gui/lib/option.tcl +++ b/git-gui/lib/option.tcl @@ -125,7 +125,7 @@ proc do_options {} { {b gui.matchtrackingbranch {mc "Match Tracking Branches"}} {b gui.fastcopyblame {mc "Blame Copy Only On Changed Files"}} {i-20..200 gui.copyblamethreshold {mc "Minimum Letters To Blame Copy On"}} - {i-0..99 gui.diffcontext {mc "Number of Diff Context Lines"}} + {i-1..99 gui.diffcontext {mc "Number of Diff Context Lines"}} {i-0..99 gui.commitmsgwidth {mc "Commit Message Text Width"}} {t gui.newbranchtemplate {mc "New Branch Name Template"}} } { -- 1.6.0