def lock(&block)
      lockfile = Lockfile.new File.join(GitModel.repo.path, 'refs/heads', branch + '.lock')
      begin
        lockfile.lock
        yield
      ensure
        lockfile.unlock
      end
    end
def lock(&block)
      lockfile = Lockfile.new File.join(GitModel.repo.path, 'refs/heads', branch + '.lock')
      begin
        lockfile.lock
        yield
      ensure
        lockfile.unlock
      end
    end
Wait until we can get an exclusive lock on the branch, then execute the
 block.  We lock the branch by creating refs/heads/<branch>.lock, which
 the git commands also seem to respect