Skip to content

Commit 9e0af0a

Browse files
Strip .git from $ModuleName
1 parent 5f7760e commit 9e0af0a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Public/Get-GitModule.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ function Get-GitModule {
4343

4444
Write-Verbose -Message "$(Get-Date -f T) processing $P1"
4545

46-
$ModuleName = ($P1 -split '/')[-1]
46+
$ModuleName = $P1.Split('/')[-1]
4747
$tempDir = Join-Path $tmpRoot $ModuleName
48-
if (!(Test-Path $tempDir)) {
48+
if (!(Test-Path $tempDir) {
49+
# Strip .git from variables if a directory that ends with .git isn't located (backwards compatibility)
50+
if ($tempDir -like '*.git') { $ModuleName = ($tempDir = $tempDir -replace '\.git$').Split('/')[-1] }
4951
Write-Verbose -Message "$(Get-Date -f T) creating directory $tempDir"
5052
New-Item $tempDir -ItemType Directory -Force | Out-Null
5153
} elseif (Get-ChildItem $tempDir -Force) {
@@ -112,4 +114,4 @@ function Get-GitModule {
112114
Write-Verbose -Message "$(Get-Date -f G) $FunctionName completed"
113115
}
114116

115-
}
117+
}

0 commit comments

Comments
 (0)