aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Lehmann <Jens.Lehmann@web.de>2009-04-06 21:05:55 +0200
committerShawn O. Pearce <spearce@spearce.org>2009-04-08 07:42:54 -0700
commitb4c813bc71f83804302f1c896c91dc499adf1922 (patch)
treeb9eaaca24755aaedb166d47643ced5c3b90074e1
parent4339d5109c847fc938cd8405001ffde4d230c09f (diff)
downloadgit-b4c813bc71f83804302f1c896c91dc499adf1922.tar.gz
git-b4c813bc71f83804302f1c896c91dc499adf1922.tar.xz
git-gui: run post-checkout hook after clone
git-gui is using "git-read-tree -u" when cloning which doesn't invoke the post-checkout hook as a plain git-clone would. So git-gui must call the hook itself. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
-rw-r--r--lib/choose_repository.tcl29
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl
index 09277e9fa..633cc572b 100644
--- a/lib/choose_repository.tcl
+++ b/lib/choose_repository.tcl
@@ -966,7 +966,34 @@ method _readtree_wait {fd} {
return
}
- set done 1
+ # -- Run the post-checkout hook.
+ #
+ set fd_ph [githook_read post-checkout [string repeat 0 40] \
+ [git rev-parse HEAD] 1]
+ if {$fd_ph ne {}} {
+ global pch_error
+ set pch_error {}
+ fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
+ fileevent $fd_ph readable [cb _postcheckout_wait $fd_ph]
+ } else {
+ set done 1
+ }
+}
+
+method _postcheckout_wait {fd_ph} {
+ global pch_error
+
+ append pch_error [read $fd_ph]
+ fconfigure $fd_ph -blocking 1
+ if {[eof $fd_ph]} {
+ if {[catch {close $fd_ph}]} {
+ hook_failed_popup post-checkout $pch_error 0
+ }
+ unset pch_error
+ set done 1
+ return
+ }
+ fconfigure $fd_ph -blocking 0
}
######################################################################