Skip to content

Commit

Permalink
Merge pull request #2804 from berbiche/fix/diagnostic-logging-for-git…
Browse files Browse the repository at this point in the history
…-vsn-command

Print diagnostic when failing to get VSN with Git
  • Loading branch information
ferd authored Jul 5, 2023
2 parents 1b6297d + 275899c commit 64842a2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/rebar/src/rebar_git_resource.erl
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,17 @@ git_ref(Dir, Arg) ->
collect_default_refcount(Dir) ->
%% Get the tag timestamp and minimal ref from the system. The
%% timestamp is really important from an ordering perspective.
case rebar_utils:sh("git log -n 1 --pretty=format:\"%h\n\" ",
Command = "git log -n 1 --pretty=format:\"%h\n\" ",
case rebar_utils:sh(Command,
[{use_stdout, false},
return_on_error,
{cd, Dir}]) of
{error, _} ->
{error, {Rc, Error}} ->
?WARN("Getting log of git repo failed in ~ts. "
"Falling back to version 0.0.0", [Dir]),
?DIAGNOSTIC("Command sh(~ts)~n"
"returned error code ~w with the following output:~n"
"~ts", [Command, Rc, Error]),
{plain, "0.0.0"};
{ok, String} ->
RawRef = rebar_string:trim(String, both, "\n"),
Expand Down

0 comments on commit 64842a2

Please sign in to comment.