{"thread":{"id":"18752","subject":"[PATCH] git-gui: run post-checkout hook after clone","startedAt":"2009-04-06T19:05:55Z","lastAt":"2009-04-06T19:05:55Z","messageCount":1,"participants":["Jens Lehmann"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"110618","messageId":"49DA5293.1000506@web.de","threadId":"18752","inReplyTo":null,"subject":"[PATCH] git-gui: run post-checkout hook after clone","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2009-04-06T19:05:55Z","receivedAt":"2009-04-06T19:05:55Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"git-gui is using \"git-read-tree -u\" when cloning which doesn't\ninvoke the post-checkout hook as a plain git-clone would.\nSo git-gui must call the hook itself.\n\nSigned-off-by: Jens Lehmann <Jens.Lehmann@web.de>\n---\n git-gui/lib/choose_repository.tcl |   29 ++++++++++++++++++++++++++++-\n 1 files changed, 28 insertions(+), 1 deletions(-)\n\ndiff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl\nindex f9ff62a..00f388f 100644\n--- a/git-gui/lib/choose_repository.tcl\n+++ b/git-gui/lib/choose_repository.tcl\n@@ -964,7 +964,34 @@ method _readtree_wait {fd} {\n \t\treturn\n \t}\n \n-\tset done 1\n+\t# -- Run the post-checkout hook.\n+\t#\n+\tset fd_ph [githook_read post-checkout [string repeat 0 40] \\\n+\t\t[git rev-parse HEAD] 1]\n+\tif {$fd_ph ne {}} {\n+\t\tglobal pch_error\n+\t\tset pch_error {}\n+\t\tfconfigure $fd_ph -blocking 0 -translation binary -eofchar {}\n+\t\tfileevent $fd_ph readable [cb _postcheckout_wait $fd_ph]\n+\t} else {\n+\t\tset done 1\n+\t}\n+}\n+\n+method _postcheckout_wait {fd_ph} {\n+\tglobal pch_error\n+\n+\tappend pch_error [read $fd_ph]\n+\tfconfigure $fd_ph -blocking 1\n+\tif {[eof $fd_ph]} {\n+\t\tif {[catch {close $fd_ph}]} {\n+\t\t\thook_failed_popup post-checkout $pch_error 0\n+\t\t}\n+\t\tunset pch_error\n+\t\tset done 1\n+\t\treturn\n+\t}\n+\tfconfigure $fd_ph -blocking 0\n }\n \n ######################################################################\n-- \n1.6.2.2.405.g4396\n"}]}