From a53fc2d8f586de1561b7f257e1857388d1fdfbbf Mon Sep 17 00:00:00 2001 From: Tuncer Ayaz Date: Sat, 27 Aug 2011 15:45:50 +0200 Subject: [PATCH] Document git vsn cmd and fix formatting --- src/rebar_app_utils.erl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/rebar_app_utils.erl b/src/rebar_app_utils.erl index 7cdf00c..5bcba44 100644 --- a/src/rebar_app_utils.erl +++ b/src/rebar_app_utils.erl @@ -152,9 +152,11 @@ vcs_vsn(Vcs, Dir) -> %% tree structure, there may be one higher up, but that can %% yield unexpected results when used with deps. So, we %% fallback to searching for a priv/vsn.Vcs file. - case file:read_file(filename:join([Dir, "priv", "vsn" ++ Extension])) of + VsnFile = filename:join([Dir, "priv", "vsn" ++ Extension]), + case file:read_file(VsnFile) of {ok, VsnBin} -> - ?DEBUG("vcs_vsn: Read ~s from priv/vsn.~p\n", [VsnBin, Vcs]), + ?DEBUG("vcs_vsn: Read ~s from priv/vsn.~p\n", + [VsnBin, Vcs]), string:strip(binary_to_list(VsnBin), right, $\n); {error, enoent} -> ?DEBUG("vcs_vsn: Fallback to vcs for ~s\n", [Dir]), @@ -163,7 +165,9 @@ vcs_vsn(Vcs, Dir) -> end end. -vcs_vsn_cmd(git) -> "git describe --always --tags `git log -n 1 --pretty=format:%h .`"; +vcs_vsn_cmd(git) -> + %% git describe a committish to accomodate for subtrees or deps/apps + "git describe --always --tags `git log -n 1 --pretty=format:%h .`"; vcs_vsn_cmd(hg) -> "hg identify -i"; vcs_vsn_cmd(bzr) -> "bzr revno"; vcs_vsn_cmd(svn) -> "svnversion";