Skip to content

Commit 64842a2

Browse files
authored
Merge pull request #2804 from berbiche/fix/diagnostic-logging-for-git-vsn-command
Print diagnostic when failing to get VSN with Git
2 parents 1b6297d + 275899c commit 64842a2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

apps/rebar/src/rebar_git_resource.erl

+6-2
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,17 @@ git_ref(Dir, Arg) ->
317317
collect_default_refcount(Dir) ->
318318
%% Get the tag timestamp and minimal ref from the system. The
319319
%% timestamp is really important from an ordering perspective.
320-
case rebar_utils:sh("git log -n 1 --pretty=format:\"%h\n\" ",
320+
Command = "git log -n 1 --pretty=format:\"%h\n\" ",
321+
case rebar_utils:sh(Command,
321322
[{use_stdout, false},
322323
return_on_error,
323324
{cd, Dir}]) of
324-
{error, _} ->
325+
{error, {Rc, Error}} ->
325326
?WARN("Getting log of git repo failed in ~ts. "
326327
"Falling back to version 0.0.0", [Dir]),
328+
?DIAGNOSTIC("Command sh(~ts)~n"
329+
"returned error code ~w with the following output:~n"
330+
"~ts", [Command, Rc, Error]),
327331
{plain, "0.0.0"};
328332
{ok, String} ->
329333
RawRef = rebar_string:trim(String, both, "\n"),

0 commit comments

Comments
 (0)