Skip to content

Commit

Permalink
try to set the origin before detecting pending chnages
Browse files Browse the repository at this point in the history
  • Loading branch information
scbedd committed Jan 27, 2023
1 parent c31d3a8 commit ec05bd1
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions tools/test-proxy/Azure.Sdk.Tools.TestProxy/Store/GitStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public async Task Push(string pathToAssetsJson) {
return;
}

SetOrigin(config);
var pendingChanges = DetectPendingChanges(config);
var generatedTagName = config.TagPrefix;

Expand All @@ -121,7 +122,6 @@ public async Task Push(string pathToAssetsJson) {
{
throw GenerateInvokeException(SHAResult);
}
SetOrigin(config);

GitHandler.Run($"tag {generatedTagName}", config);
GitHandler.Run($"push origin {generatedTagName}", config);
Expand Down Expand Up @@ -173,6 +173,7 @@ public async Task Reset(string pathToAssetsJson)
InitializeAssetsRepo(config);
}

SetOrigin(config);
var pendingChanges = DetectPendingChanges(config);

if (pendingChanges.Length > 0)
Expand Down Expand Up @@ -217,6 +218,8 @@ public async Task Reset(string pathToAssetsJson)
await BreadCrumb.Update(config);
}
}

HideOrigin(config);
}

/// <summary>
Expand Down Expand Up @@ -249,16 +252,6 @@ public string[] DetectPendingChanges(GitAssetsConfiguration config)
{
SetSafeDirectory(config);

var a = Environment.GetEnvironmentVariable(GIT_COMMIT_OWNER_ENV_VAR);
var b = Environment.GetEnvironmentVariable(GIT_COMMIT_EMAIL_ENV_VAR);

var preface = "";
if (null != a && null != b)
{
preface = $"-c user.name =\"{a}\" -c user.email=\"{b}\" ";
}

var run = $"{preface}status --porcelain";
if (!GitHandler.TryRun($"status --porcelain", config.AssetsRepoLocation.ToString(), out var diffResult))
{
throw GenerateInvokeException(diffResult);
Expand Down

0 comments on commit ec05bd1

Please sign in to comment.