The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Signal 13 Problems with Git Hooks

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Jake Scruggs

Posts: 336
Nickname: aurorae314
Registered: Feb, 2008

Jake Scruggs is a developer at ThoughtWorks
Signal 13 Problems with Git Hooks Posted: Jul 20, 2010 11:00 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Jake Scruggs.
Original Post: Signal 13 Problems with Git Hooks
Feed Title: Jake Scruggs
Feed URL: http://jakescruggs.blogspot.com/feeds/posts/default
Feed Description: Ruby, Rails, Metrics, Testing, and pursuit of clean code.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Jake Scruggs
Latest Posts From Jake Scruggs

Advertisement
Ran into a gotcha in Git today when trying to write a post push hook. We want our designer to have a fast turn around time with clients so we're writing some hooks to merge all of the 'theme' branches he works with to get merged into a special preview branch witch is then deployed to the preview site. And all this should happen after he does a 'git push.' Seems like a 'post-receive' hook is just what we want.

Except that every time we tried to create one we got these errors on a push:


error: git-shell died of signal 13
fatal: The remote end hung up unexpectedly
error: error in sideband demultiplexer

If the 'post-receive' file even existed in git_dir/hooks/ on the git repo box, we got this error. We checked permissions, gitolite docs, git docs, google, etc and no help. We finally realized that Git was piping in some information to our 'post-receive' file and since we were not consuming it, that was causing the explosion.

So, I present to you, a stub of 'post-receive' file written in Ruby:


#!/usr/bin/env ruby
STDIN.readlines.each do |line|
rev_old, rev_new, ref = line.split(" ")
# You will get in here as many times as branches were pushed
end


rev_old is the old commit hash, rev_new is the new commit hash, and ref will be something like: "refs/heads/test_branch" Useful information.

Git often passes things into it's hooks, check the git book docs to find out what.

Read: Signal 13 Problems with Git Hooks

Topic: Debugging Into The Flex SDK Previous Topic   Next Topic Topic: A little overdue: A MountainWest RubyComic

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use