anchor.diff:      rebar_utils:sh(?FMT("git checkout -q ~s", [Rev]), [{cd, Dir}]).
   
   make_vsn(Dir) ->
  -    Cwd = rebar_dir:get_cwd(),
  -    try
  -        ok = file:set_cwd(Dir),
  -        {Vsn, RawRef, RawCount} = collect_default_refcount(),
  -        {plain, build_vsn_string(Vsn, RawRef, RawCount)}
  -    after
  -        file:set_cwd(Cwd)
  -    end.
  +    {Vsn, RawRef, RawCount} = collect_default_refcount(Dir),
  +    {plain, build_vsn_string(Vsn, RawRef, RawCount)}.
   
   %% Internal functions
   
  -collect_default_refcount() ->
  +collect_default_refcount(Dir) ->
       %% Get the tag timestamp and minimal ref from the system. The
       %% timestamp is really important from an ordering perspective.
       AbortMsg1 = "Getting log of git dependency failed in " ++ rebar_dir:get_cwd(),
       {ok, String} =
           rebar_utils:sh("git log -n 1 --pretty=format:\"%h\n\" ",
                          [{use_stdout, false},
  +                        {cd, Dir},
                           {debug_abort_on_error, AbortMsg1}]),
       RawRef = string:strip(String, both, $\n),
   
  -    {Tag, TagVsn} = parse_tags(),
  +    {Tag, TagVsn} = parse_tags(Dir),
       {ok, RawCount} =
           case Tag of
               undefined ->
  
positive.code:     rebar_utils:line_count(PatchLines).
  
  
  parse_tags() ->
      %% Don't abort on error, we want the bad return to be turned into 0.0.0
      case rebar_utils:sh("git log --oneline --no-walk --tags --decorate",
                          [{use_stdout, false}, return_on_error]) of
          {error, _} ->
              {undefined, "0.0.0"};
          {ok, Line} ->
  
negative.code:                                                            integer_to_list(Count), RefTag]))
      end.
  
  get_patch_count(Dir, RawRef) ->
      AbortMsg = "Getting rev-list of git dep failed in " ++ Dir,
      Ref = re:replace(RawRef, "\\s", "", [global]),
      Cmd = io_lib:format("git rev-list ~s..HEAD",
                           [Ref]),
  