Skip to content

Commit c3a3257

Browse files
committed
More fixes to git stash when bumping version
1 parent 86582ea commit c3a3257

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Build/set-version-UnitsNet.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ $winrtNuspecFile = "$root\UnitsNet.WindowsRuntimeComponent\UnitsNet.WindowsRunti
6161
$newVersion = Get-NewProjectVersion $projFile $paramSet $setVersion $bumpVersion
6262

6363
# Reset and stash any other local changes.
64-
Invoke-StashPush
64+
$didStash = Invoke-StashPush
6565

6666
# Update project files
6767
Set-ProjectVersion $projFile $newVersion
@@ -79,4 +79,6 @@ Invoke-CommitVersionBump @("UnitsNet") $newVersion
7979
Invoke-TagVersionBump "UnitsNet" $newVersion
8080

8181
# Restore any local changes.
82-
Invoke-StashPop
82+
if ($didStash) {
83+
Invoke-StashPop
84+
}

Build/set-version.psm1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ function Get-NewProjectVersion(
1717
}
1818

1919
function Invoke-StashPush() {
20+
$oldSha=$(git rev-parse -q --verify refs/stash)
2021
git reset --quiet
21-
git stash --include-untracked --message "Before version bump" --quiet
22+
git stash push --include-untracked --message "Before version bump" --quiet
23+
$newSha=$(git rev-parse -q --verify refs/stash)
24+
return $oldSha -ne $newSha
2225
}
2326

2427
function Invoke-StashPop() {

0 commit comments

Comments
 (0)