Re: [PATCH] git-gui: run post-checkout hook on checkout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Shawn O. Pearce schrieb:
> Jens Lehmann <Jens.Lehmann@xxxxxx> wrote:
>> +	# -- Run the post-checkout hook.
>> +	#
>> +	set fd_ph [githook_read post-checkout $old_hash $new_hash 1]
>> +	if {$fd_ph ne {}} {
>> +		upvar #0 pch_error pc_err
> 
> I'd rather spell this "global pch_error".
> 
>> +		set pc_err {}

What i noticed when fixing this issue is that i copied this upvar
statement from the calling of the post-commit hook in commit.tcl
with only a minor change (ommitting the "$cmt_id" behind
"pch_error").

It does seem to be incorrect there too, as i couldn't find any use
of the variable "pc_err" or "pch_error$cmt_id" anywhere in git-gui.
So setting "pc_err" to empty seems pretty pointless, as everywhere
else in commit.tcl "pch_error" is used instead.

Or am i overlooking something? If not, the patch below should correct
that.

Jens

--------------------- 8>< ---------------------

>From 5ddd7e8c2d52fc99e496ed3bc96358cc07e538f1 Mon Sep 17 00:00:00 2001
From: Jens Lehmann <Jens.Lehmann@xxxxxx>
Date: Mon, 30 Mar 2009 20:35:57 +0200
Subject: [PATCH] git-gui: When calling post-commit hook wrong variable was cleared.

Before calling the post-commit hook, the variable "pc_err" is cleared
while later only "pch_error" is used. "pch_error$cmt_id" only appeared in
"upvar"-Statements (which were changed to "global") and was removed.

Signed-off-by: Jens Lehmann <Jens.Lehmann@xxxxxx>
---
 git-gui/lib/commit.tcl |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/git-gui/lib/commit.tcl b/git-gui/lib/commit.tcl
index 9cc8410..7255efb 100644
--- a/git-gui/lib/commit.tcl
+++ b/git-gui/lib/commit.tcl
@@ -398,8 +398,8 @@ A rescan will be automatically started now.
 	#
 	set fd_ph [githook_read post-commit]
 	if {$fd_ph ne {}} {
-		upvar #0 pch_error$cmt_id pc_err
-		set pc_err {}
+		global pch_error
+		set pch_error {}
 		fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
 		fileevent $fd_ph readable \
 			[list commit_postcommit_wait $fd_ph $cmt_id]
@@ -461,7 +461,7 @@ A rescan will be automatically started now.
 }
 
 proc commit_postcommit_wait {fd_ph cmt_id} {
-	upvar #0 pch_error$cmt_id pch_error
+	global pch_error
 
 	append pch_error [read $fd_ph]
 	fconfigure $fd_ph -blocking 1
-- 
1.6.2.1.414.g2daa3


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux