Git clone fixed

This commit is contained in:
2018-07-23 17:15:28 +02:00
parent e75558b01f
commit 2c3d81b950
8 changed files with 28 additions and 16 deletions

View File

@ -13,6 +13,7 @@ namespace Yavsc.Lib
public class GitClone : Batch<Project>
{
string _repositoryRootPath;
string gitPath="git";
public GitClone(string repoRoot)
{
@ -28,10 +29,10 @@ namespace Yavsc.Lib
// Model annotations => input.Repository!=null => input.Name == input.Repository.Path
var prjPath = Path.Combine(WorkingDir, input.Name);
var repoInfo = new DirectoryInfo(prjPath);
var gitCmd = repoInfo.Exists ? "pull" : "clone";
var gitCmd = repoInfo.Exists ? "pull" : "clone --depth=1";
var cloneStart = new ProcessStartInfo
( gitCmd, $"{gitCmd} {input.Repository.Url} {input.Repository.Path}" )
( gitPath, $"{gitCmd} {input.Repository.Url} {input.Repository.Path}" )
{
WorkingDirectory = WorkingDir,
RedirectStandardOutput = true,
@ -52,7 +53,7 @@ namespace Yavsc.Lib
writer.WriteLine(process.StandardOutput.ReadLine());
}
}
ResultHandler(true);
if (ResultHandler!=null) ResultHandler(true);
}
}
}