Browse Source

fix git --no-tags error on some boxes

Namdak Tonpa 6 years ago
parent
commit
6e00e3f87b
3 changed files with 9 additions and 4 deletions
  1. 1 1
      include/mad.hrl
  2. BIN
      mad
  3. 8 3
      src/mad_git.erl

+ 1 - 1
include/mad.hrl

@@ -1 +1 @@
--define(VERSION,"ae853b").
+-define(VERSION,"fa229b").

BIN
mad


+ 8 - 3
src/mad_git.erl

@@ -47,9 +47,14 @@ get_repo([Name|_]) ->
          {ok,N,Uri} -> fetch_dep(Cwd,Conf,File,N,"git",Uri,[],deps_fetch,[])
     end end.
 
-git_clone(Uri,Fast,TrunkPath,[]) -> git_clone(Uri,Fast,TrunkPath,"master");
-git_clone(Uri,Fast,TrunkPath,Rev) ->
-    {["git clone --single-branch --no-tags --branch ",Rev," ",Fast,Uri," ",TrunkPath],Rev}.
+git_clone(Uri,Fast,TrunkPath,Rev) when Rev == "head"   orelse Rev == "HEAD"
+                                orelse Rev == "master" orelse Rev == [] ->
+    {["git clone ",Fast,Uri," ",TrunkPath],Rev};
+
+git_clone(Uri,_Fast,TrunkPath,Rev) ->
+    {["git clone ",Uri," ",TrunkPath,
+      " && cd ",TrunkPath,
+      " && git checkout \"",Rev,"\"" ],Rev}.
 
 fetch_dep(Cwd, Config, ConfigFile, Name, Cmd, Uri, Co, Cache) ->
     fetch_dep(Cwd, Config, ConfigFile, Name, Cmd, Uri, Co, Cache, deep).