Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit-binary.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Ungureanu <marius.ungureanu@xamarin.com>2015-06-28 19:38:08 +0300
committerMarius Ungureanu <marius.ungureanu@xamarin.com>2015-06-28 19:38:08 +0300
commit9c926f2032b40338a3a64c2c8e05ab9fecbdb7c0 (patch)
tree05545a23aa14b71e2d318cfe288f5579646290e3
parent523d6c4988af9ceb56cb59b4b17f2b1692eec8a2 (diff)
Guard against concurrency issues.
-rw-r--r--build.libgit2.ps124
1 files changed, 22 insertions, 2 deletions
diff --git a/build.libgit2.ps1 b/build.libgit2.ps1
index 5e58dc2..2f1bca8 100644
--- a/build.libgit2.ps1
+++ b/build.libgit2.ps1
@@ -83,11 +83,28 @@ function Assert-Consistent-Naming($expected, $path) {
Ensure-Property $expected $dll.VersionInfo.OriginalFilename "VersionInfo.OriginalFilename" $dll.Fullname
}
+function Check-Newer-Binaries {
+ $old = Get-Item "$x86Directory\*.dll"
+ $oldSha = $old.Name.Substring("git2-".Length).Substring(0, 7)
+ try {
+ Push-Location $libgit2Directory
+ & git merge-base --is-ancestor $sha $oldSha
+ if ($LastExitCode -eq 0) {
+ Write-Output "Binaries are newer in the output directory."
+ Exit
+ }
+ } finally {
+ Pop-Location
+ }
+}
+
if (Test-Path(Join-Path $x86Directory "$binaryFilename.dll")) {
- Write-Output "Binaries don't need rebuilding!"
+ Write-Output "Binaries are the same as in output directory."
Exit
}
+Check-Newer-Binaries
+
try {
Push-Location $libgit2Directory
@@ -110,9 +127,12 @@ try {
}
Run-Command { & mkdir -fo "$x86Directory" }
Run-Command { & copy -fo "$libgit2Directory\build\$configuration\*" -Destination $x86Directory -Exclude *.lib }
+ Run-Command { & git stash save }
+ Run-Command -Fatal { & git pull }
+ Check-Newer-Binaries
+ Run-Command -Fatal { & git stash pop }
Run-Command -Fatal { & git add "$x86Directory" }
Run-Command -Fatal { & git commit -m "Bumping Windows libgit2 to $sha" }
- Run-Command -Fatal { & git pull --rebase }
Run-Command -Fatal { & git push }
#Write-Output "Building 64-bit..."