anchor.diff:      IsDir = filelib:is_dir(Path),
       clone_if_needed(IsDir, GitRepo, Path),
   
  -    checkout_ref(Path, CommitIsh, BR),
  +    ok = case checkout_ref(Path, CommitIsh, BR) of
  +        ok -> ok;
  +        error -> builderl_build_registry:set_build_state(ID, checkout_failed),
  +                 error
  +    end,
       build_project(Path, BuilderlFile, BR),
  -
       ok.
   
   clone_if_needed(false, GitRepo, Path) ->
  
positive.code:     erlang:spawn(builderl, build_proc, [BR]),
      {ok, BuildID}.
  
  build_proc(BR=#buildrecord{committish=CommitIsh, repo=GitRepo}) ->
      lager:debug("Commit-ish ~p", [CommitIsh]),
  
      Time = erlang:monotonic_time(seconds),
  
negative.code: 
  checkout_ref(Path, Ref, BR) ->
      build_record_message(BR, ["Checking out project ", Ref, " to ", Path]),
      Resp = git:checkout(Path, Ref),
      handle_checkout(Resp, BR).
  
  handle_checkout({ok, _Msg}, BR) ->
      build_record_message(BR, ["Checkout succeeded!"]),
      ok;
  handle_checkout({_, {_Code, Msg}}, BR) ->
      build_record_message(BR, ["Checkout failed! ", Msg]),
      error.
  
  build_record_message(BR, Msg) ->
      Filename = filename_from_br(BR),
  