Skip to content

Commit 5519eea

Browse files
committed
Fixes for LibGit2Sharp 0.25.0
Fix build bugs Fix cross-platform native assembly loading Fix changed properties (or at least, those caught by tests)
1 parent f4e161a commit 5519eea

File tree

6 files changed

+22
-31
lines changed

6 files changed

+22
-31
lines changed

Build.ps1

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,15 @@ function clean {
127127
Remove-Item $ReleasePath -Force -Recurse
128128
}
129129

130-
if(Test-Path $Path\packages) {
130+
if (Test-Path $Path\packages) {
131131
Trace-Message "DELETE $Path\packages"
132132
# force reinstall by cleaning the old ones
133133
Remove-Item $Path\packages\ -Recurse -Force -ErrorAction Continue
134134
}
135-
if(Test-Path $Path\packages\build.log) {
135+
if (Test-Path $OutputPath\packages\build.log) {
136136
Trace-Message "DELETE $OutputPath\build.log"
137137
Remove-Item $OutputPath\build.log -Recurse -Force -ErrorAction Continue
138138
}
139-
140139
}
141140

142141
function update {
@@ -243,10 +242,12 @@ function build {
243242
$ReleaseModule = Join-Path $ReleasePath ${RootModule}
244243
Trace-Message " Setting content for $ReleaseModule"
245244

246-
$FunctionsToExport = Join-Path $SourcePath Public\*.ps1 -Resolve | % { [System.IO.Path]::GetFileNameWithoutExtension($_) }
245+
$FunctionsToExport = Join-Path $SourcePath Public\*.ps1 -Resolve |
246+
ForEach-Object { [System.IO.Path]::GetFileNameWithoutExtension($_) }
247+
247248
Set-Content $ReleaseModule ((
248-
(Get-Content (Join-Path $SourcePath Private\*.ps1) -Raw) +
249-
(Get-Content (Join-Path $SourcePath Public\*.ps1) -Raw)) -join "`r`n`r`n`r`n") -Encoding UTF8
249+
$(Get-Content -Raw $(Join-Path $SourcePath Private\*.ps1) -ErrorAction SilentlyContinue) +
250+
$(Get-Content -Raw $(Join-Path $SourcePath Public\*.ps1))) -join "`r`n`r`n`r`n") -Encoding UTF8
250251

251252
# If there are any folders that aren't Public, Private, Tests, or Specs ...
252253
$OtherFolders = Get-ChildItem $SourcePath -Directory -Exclude Public, Private, Tests, Specs
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function Get-Log {
6969
$Parents = @($Parents)[0].Parents
7070
$CommitsSinceVersionSource += 1
7171
Write-Verbose "Check parent $(@($Parents)[0].Id) for tags"
72-
} while ($Parents.Tags.Name -notmatch $TagPattern)
72+
} while ($Parents -and ($Parents.Tags.Name -notmatch $TagPattern))
7373

7474
# We are always building the NEXT version
7575
if (@($Parents)[0].Tags.Name -match $TagPattern) {

lib/Pester

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 1e7f118f920f8648ed0be8ed88a2184f6a0b3ccc

src/PSGit.formats.ps1xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,6 @@
121121
</TableRowEntry>
122122
</TableRowEntries>
123123
</TableControl>
124-
</View>
124+
</View>
125125
</ViewDefinitions>
126126
</Configuration>

src/PSGit.psm1

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,15 @@
55
# } catch {}
66
# $Arch = "-" + [Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture
77

8-
Get-ChildItem -Directory -Path $PSScriptRoot\runtimes\ -Recurse -Filter 'native' |
9-
ForEach-Object {
10-
# For windows
11-
$env:PATH = '{0}{1}{2}' -f @(
12-
$_.FullName
13-
[System.IO.Path]::PathSeparator
14-
$env:PATH
15-
)
16-
# For Linux
17-
$env:LD_LIBRARY_PATH = '{0}{1}{2}' -f @(
18-
$_.FullName
19-
[System.IO.Path]::PathSeparator
20-
$env:LD_LIBRARY_PATH
21-
)
22-
# For macOS
23-
$env:DYLD_LIBRARY_PATH = '{0}{1}{2}' -f @(
24-
$_.FullName
25-
[System.IO.Path]::PathSeparator
26-
$env:DYLD_LIBRARY_PATH
27-
)
8+
# Add-Type -Path (Join-Path (Join-Path $PSScriptRoot NativeBinaries\$runtime)
9+
${;} = [System.IO.Path]::PathSeparator
10+
switch -Wildcard (Get-ChildItem -Path "$PSScriptRoot\lib\NativeBinaries\*\native" -Recurse -Filter '*git2-6311e88.*') {
11+
"*.so" { $env:LD_LIBRARY_PATH = "" + $_.Directory + ${;} + $Env:LD_LIBRARY_PATH }
12+
"*.dll" { $env:PATH = "" + $_.Directory + ${;} + $Env:PATH }
13+
"*.dyld" { $env:DYLD_LIBRARY_PATH = "" + $_.Directory + ${;} + $Env:DYLD_LIBRARY_PATH }
2814
}
2915

16+
3017
# Internal Functions
3118
#region Interal Functions
3219
function WriteMessage {
@@ -260,10 +247,12 @@ function Get-Change {
260247
}
261248

262249
$BranchProperties =
263-
@{ Name="Branch"; Expr={$_.Name}},
250+
@{ Name="Branch"; Expr={$_.FriendlyName}}, # Changed in LibGit2Sharp 0.25
264251
@{ Name="IsHead"; Expr={ $_.IsCurrentRepositoryHead}}, "IsRemote", "IsTracking",
265252
@{ Name="Tip"; Expr={$_.Tip.Sha}},
266-
@{ Name="Remote"; expr = { $_.Remote.Url } },
253+
# This got more expensive in LibGit2Sharp 0.25
254+
# Might be easier to use RemoteName, but to maintain compatibility:
255+
@{ Name="Remote"; expr = { $_.Repository.Network.Remotes[$_.RemoteName].Url } },
267256
@{ Name="Ahead"; Expr= { $_.TrackingDetails.AheadBy }},
268257
@{ Name="Behind"; Expr = { $_.TrackingDetails.BehindBy }},
269258
@{ Name="CommonAncestor"; Expr={ $_.TrackingDetails.CommonAncestor.Sha }},

src/PSGit.types.ps1xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Members>
66
<AliasProperty>
77
<Name>Branch</Name>
8-
<ReferencedMemberName>Name</ReferencedMemberName>
8+
<ReferencedMemberName>FriendlyName</ReferencedMemberName>
99
</AliasProperty>
1010
<ScriptProperty>
1111
<Name>Ahead</Name>

0 commit comments

Comments
 (0)