git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Keith Cascio <keith@cs.ucla.edu>
To: Shawn O Pearce <spearce@spearce.org>
Cc: git@vger.kernel.org
Subject: [PATCH git-gui v2 1/2] Teach git-gui to use --primer.
Date: Mon,  2 Feb 2009 11:32:00 -0800	[thread overview]
Message-ID: <1233603121-1430-2-git-send-email-keith@cs.ucla.edu> (raw)
In-Reply-To: <1233603121-1430-1-git-send-email-keith@cs.ucla.edu>

Teach git-gui to use --primer.
Also teach it to check diff's exit code instead of relying on piped
output, which could be altered as a consequence of primer options.

Signed-off-by: Keith Cascio <keith@cs.ucla.edu>
---
 lib/diff.tcl |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/diff.tcl b/lib/diff.tcl
index bbbf15c..0e1e4a3 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -276,6 +276,8 @@ proc start_show_diff {cont_info {add_opts {}}} {
 	}
 
 	lappend cmd -p
+	lappend cmd --exit-code
+	lappend cmd --primer
 	lappend cmd --no-color
 	if {$repo_config(gui.diffcontext) >= 1} {
 		lappend cmd "-U$repo_config(gui.diffcontext)"
@@ -310,6 +312,7 @@ proc read_diff {fd cont_info} {
 	global ui_diff diff_active
 	global is_3way_diff is_conflict_diff current_diff_header
 	global current_diff_queue
+	global errorCode
 
 	$ui_diff conf -state normal
 	while {[gets $fd line] >= 0} {
@@ -397,7 +400,9 @@ proc read_diff {fd cont_info} {
 	$ui_diff conf -state disabled
 
 	if {[eof $fd]} {
-		close $fd
+		fconfigure $fd -blocking 1
+		catch { close $fd } err
+		set diff_exit_status $errorCode
 
 		if {$current_diff_queue ne {}} {
 			advance_diff_queue $cont_info
@@ -413,7 +418,7 @@ proc read_diff {fd cont_info} {
 		}
 		ui_ready
 
-		if {[$ui_diff index end] eq {2.0}} {
+		if {$diff_exit_status eq "NONE"} {
 			handle_empty_diff
 		}
 		set callback [lindex $cont_info 1]
-- 
1.6.1

  reply	other threads:[~2009-02-02 19:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-02 19:31 [PATCH git-gui v2 0/2] Teach git-gui to use --primer Keith Cascio
2009-02-02 19:32 ` Keith Cascio [this message]
2009-02-02 19:32   ` [PATCH git-gui v2 2/2] Hooks for new config variable "diff.primer" Keith Cascio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1233603121-1430-2-git-send-email-keith@cs.ucla.edu \
    --to=keith@cs.ucla.edu \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).