     patches = batch.id
     |> Patch.all_for_batch()
     |> Repo.all()
-    state = bisect(patches)
+    state = bisect(patches, project)
     send_message(repo_conn, patches, {state, erred})
     Project.ping!(project.id)
   end

    :ok
  end

  defp bisect(patches) do
    count = Enum.count(patches)
    if count > 1 do
      project = patches[0].project
      {patches_lo, patches_hi} = Enum.split(patches, div(count, 2))
      make_batch(patches_lo, project.id)
      make_batch(patches_hi, project.id)

          commit_message: commit_message}))
    case head do
      :conflict ->
        state = bisect(patches, project)
        send_message(repo_conn, patches, {:conflict, state})
      commit ->
        state = setup_statuses(repo_conn, batch, patches)
