Skip to content

Commit 709a53b

Browse files
committed
Do not pop unrelated changes
1 parent d9664a0 commit 709a53b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/tooling/docs-builder/Tracking/LocalGitRepositoryTracker.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ public IEnumerable<GitChange> GetChangedFiles()
1717
var defaultBranch = GetDefaultBranch();
1818
var commitChanges = CaptureMultiple("git", "diff", "--name-status", $"{defaultBranch}...HEAD", "--", $"./{LookupPath}");
1919
var localChanges = CaptureMultiple("git", "status", "--porcelain");
20-
ExecInSilent([], "git", "stash", "push", "--", $"./{LookupPath}");
21-
var localUnstagedChanges = CaptureMultiple("git", "stash", "show", "--name-status", "-u");
22-
ExecInSilent([], "git", "stash", "pop");
20+
var captured = Capture("git", "stash", "push", "--", $"./{LookupPath}");
21+
var localUnstagedChanges = Array.Empty<string>();
22+
if (captured != "No local changes to save")
23+
{
24+
localUnstagedChanges = CaptureMultiple("git", "stash", "show", "--name-status", "-u");
25+
ExecInSilent([], "git", "stash", "pop");
26+
}
2327

2428
return [.. GetCommitChanges(commitChanges), .. GetLocalChanges(localChanges), .. GetCommitChanges(localUnstagedChanges)];
2529
}

0 commit comments

Comments
 (0)