Browse Source

Don't depend on git binary to be present in PATH

Nikita Tsukanov 9 năm trước cách đây
mục cha
commit
172cdb60be
1 tập tin đã thay đổi với 3 bổ sung8 xóa
  1. 3 8
      build.cake

+ 3 - 8
build.cake

@@ -129,16 +129,11 @@ var buildDirs =
 Information("Getting git modules:");
 
 IEnumerable<string> subModules;
-var gitSettings = new ProcessSettings { Arguments = "config --file .gitmodules --get-regexp path", RedirectStandardOutput = true };
-var exitCode = StartProcess("git", gitSettings, out subModules);
-if (exitCode != 0)
-{
-    throw new Exception("Failed to retrieve git submodule paths.");
-}
+var gitSettings = System.IO.File.ReadAllLines(".git/config");
 
-var ignoredSubModulesPaths = subModules.Select(m => 
+var ignoredSubModulesPaths = gitSettings.Where(m=>m.StartsWith("[submodule ")).Select(m => 
 {
-    var path = m.Split(' ')[1];
+    var path = m.Split(' ')[1].Trim("\"[] \t".ToArray());
     Information(path);
     return ((DirectoryPath)Directory(path)).FullPath;
 }).ToList();