Skip to content

Commit f77f75e

Browse files
committed
ps7 parameters to git is more strict now -- fix quoted paths and empty extraArgs
1 parent 4214c6f commit f77f75e

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

lib/Parse-GitStatus.ps1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ function Parse-GitStatus($includeNumstat = $false, $extraArgs) {
2626

2727
# ATTN: git status --porcelain returns paths relative from the repository root folder
2828
# git status -s *could* change in the future but returns paths relative to pwd.
29-
$allFiles = Invoke-Git status -s $extraArgs | % {
29+
30+
$allArgs = @('status', '-s')
31+
if ($extraArgs) { $allArgs += $extraArgs }
32+
$allFiles = Invoke-Git @allArgs | % {
3033
$relativePath = $_.Substring(3).Replace("`"", "")
3134

3235
if ($relativePath -match " -> ") {

lib/actions/Git-NumberedAdd.ps1

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@ function Git-NumberedAdd {
88
return
99
}
1010

11-
$files = $fileInfos | % {
12-
if ($_ -is [string]) {
13-
$commitMsg = $_
11+
$files = @()
12+
$commitMsg = $null
13+
foreach ($item in $fileInfos) {
14+
if ($item -is [string]) {
15+
$commitMsg = $item
1416
} else {
15-
$_.fullPath
17+
$files += $item.FullPath.Trim('"')
1618
}
1719
}
18-
# write-host "git add -v $files"
19-
git add -v $files
2020

21+
git add -v @files
2122

2223
if ($commitMsg) {
2324
git commit -m $commitMsg
@@ -35,6 +36,6 @@ function Git-NumberedAddPatch {
3536
return
3637
}
3738

38-
$files = $fileInfos | % {$_.fullPath}
39-
git add $files -vp
39+
$files = $fileInfos | % {$_.fullPath.Trim('"')}
40+
git add @files -vp
4041
}

0 commit comments

Comments
 (0)