-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
6 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,13 +38,11 @@ public string Sync(string workingDirectory, string? gitRef = null, string? repoU | |
if (!Path.IsPathRooted(repoDirectory)) | ||
repoDirectory = Path.Join(Directory.GetCurrentDirectory(), repoDirectory); | ||
|
||
|
||
if (!Directory.Exists(repoDirectory)) | ||
Clone(repoUrl, repoDirectory, gitRef); | ||
|
||
Pull(repoDirectory, gitRef); | ||
|
||
|
||
return repoDirectory; | ||
} | ||
|
||
|
@@ -96,14 +94,19 @@ private void Pull(string repoDirectory, string gitRef) | |
_log.Debug("Opening repository in: {RepositoryPath}", repoDirectory); | ||
|
||
using var repository = new Repository(repoDirectory); | ||
//Set a dummy identity | ||
_log.Debug("Setting identity"); | ||
repository.Config.Set("user.name", "ss14.mapserver"); | ||
repository.Config.Set("user.email", "[email protected]"); | ||
|
||
_log.Debug("Fetching ref"); | ||
_buildService.Run(repoDirectory, "git", new List<string> { "fetch origin", gitRef }).Wait(); | ||
|
||
_log.Debug("Checking out {Ref}", StripRef(gitRef)); | ||
Commands.Checkout(repository, StripRef(gitRef)); | ||
|
||
_log.Debug("Pulling latest changes"); | ||
_buildService.Run(repoDirectory, "git", new List<string> { "pull origin HEAD" }).Wait(); | ||
_buildService.Run(repoDirectory, "git", new List<string> { "pull origin HEAD --ff-only" }).Wait(); | ||
|
||
_log.Debug("Updating submodules"); | ||
foreach (var submodule in repository.Submodules) | ||
|