   end
 
   defp get_rev_info do
-    origin = run_system("git", ["--git-dir=.git" , "config" , "remote.origin.url"])
-    rev = run_system("git", ["--git-dir=.git" , "rev-parse" , "--verify", "--quiet", "HEAD"])
-    [ origin: origin, rev: rev ]
+    destructure [origin, rev],
+      :os.cmd('git --git-dir=.git config remote.origin.url && git --git-dir=.git rev-parse --verify --quiet HEAD')
+      |> IO.iodata_to_binary
+      |> String.split("\n", trim: true)
+    [origin: origin, rev: rev]
   end
 
   defp update_origin(location) do
-    _ = System.cmd("git", ["--git-dir=.git", "config" , "remote.origin.url", location])
+    git!(["--git-dir=.git", "config" , "remote.origin.url", location])
     :ok
   end
 
-  defp run_system(cmd, args) do
-    System.cmd(cmd, args)
-    |> elem(0)
-    |> String.strip
-  end 
-
-  defp run_cmd_or_raise(cmd, args) do
-    {_,status} = System.cmd(cmd, args, stderr_to_stdout: true )
+  defp git!(args) do
+    {output, status} = System.cmd("git", args, stderr_to_stdout: true)
     if status != 0 do
-      Mix.raise "Command `#{cmd} #{Enum.join(args, " ")}` failed"
+      Mix.raise "Command `git #{Enum.join(args, " ")}` failed. Output:\n#{output}"
     end
     true
   end

    location = opts[:git]

    _ = File.rm_rf!(path)
    cmd = "git"
    args = ["clone", "--no-checkout", "--progress", location, path]
  
    run_cmd_or_raise(cmd, args)
    File.cd! path, fn -> do_checkout(opts) end
  end


      {:ok, true} ->
        :ok
      :error ->
        if System.find_executable("git") do
          Mix.State.put(:git_available, true)
        else
          Mix.raise "Error fetching/updating Git repository: the `git` "  <>
