summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Klötzke <jan.kloetzke@freenet.de>2011-09-29 22:42:27 +0200
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2011-10-20 16:27:35 +0200
commit85575fca65e53bdf0489ba8ea21c34dcc7cfedbc (patch)
tree7ee363d99dc0e55842b511ca1bc9348e4ad8ac27
parentb535b5eea82f5d73191915e790b0702e143c1957 (diff)
rebar_app_utils: fix git hook for Windows
-rw-r--r--src/rebar_app_utils.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rebar_app_utils.erl b/src/rebar_app_utils.erl
index 1281752..6dc7dec 100644
--- a/src/rebar_app_utils.erl
+++ b/src/rebar_app_utils.erl
@@ -171,7 +171,14 @@ vcs_vsn_cmd(git) ->
%% Explicitly git-describe a committish to accommodate for projects
%% in subdirs which don't have a GIT_DIR. In that case we will
%% get a description of the last commit that touched the subdir.
- "git describe --always --tags `git log -n 1 --pretty=format:%h .`";
+ case os:type() of
+ {win32,nt} ->
+ "FOR /F \"usebackq tokens=* delims=\" %i in "
+ "(`git log -n 1 \"--pretty=format:%h\" .`) do "
+ "@git describe --always --tags %i";
+ _ ->
+ "git describe --always --tags `git log -n 1 --pretty=format:%h .`"
+ end;
vcs_vsn_cmd(hg) -> "hg identify -i";
vcs_vsn_cmd(bzr) -> "bzr revno";
vcs_vsn_cmd(svn) -> "svnversion";