Skip to content

Commit 7ac91ce

Browse files
committed
ps7: better handling of one vs multiple files and bugfix quoted paths
1 parent 9d0a44d commit 7ac91ce

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lib/actions/Git-NumberedCheckout.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ function Git-NumberedCheckout {
88
return
99
}
1010

11-
$toCheckout = $fileInfos | % {$_.fullPath}
12-
git checkout HEAD $toCheckout
11+
$toCheckout = $fileInfos | % {$_.fullPath.Trim('"')}
12+
git checkout HEAD @($toCheckout)
1313
}

lib/actions/Git-NumberedDiff.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ function Git-NumberedDiff {
1414

1515
# git add -N, --intent-to-add
1616
# so that new files are shown in the diff
17-
$newFiles = $fileInfos | ? {$_.state -eq 'A'} | % {$_.fullPath}
17+
$newFiles = $fileInfos | ? {$_.state -eq 'A'} | % {$_.fullPath.Trim('"')}
1818
if ($newFiles) {
1919
Write-Host "git add --intent-to-add $newFiles"
20-
git add -Nv $newFiles
20+
git add -Nv @($newFiles)
2121
}
2222

2323
# Filter deleted files from diff (git doesn't like it)
24-
$files = $fileInfos | ? {$_.state -ne 'D'} | % {$_.fullPath}
25-
git diff $files
24+
$files = $fileInfos | ? {$_.state -ne 'D'} | % {$_.fullPath.Trim('"')}
25+
git diff @($files)
2626
}
2727

2828

@@ -40,6 +40,6 @@ function Git-NumberedDiffCached {
4040
return
4141
}
4242

43-
$files = $fileInfos | % {$_.fullPath}
44-
git diff --cached $files
43+
$files = $fileInfos | % {$_.fullPath.Trim('"')}
44+
git diff --cached @($files)
4545
}

lib/actions/Git-NumberedReset.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ function Git-NumberedReset {
88
return
99
}
1010

11-
$toReset = $fileInfos | % {$_.fullPath}
12-
git reset HEAD $toReset
11+
$toReset = $fileInfos | % {$_.fullPath.Trim('"')}
12+
git reset HEAD @($toReset)
1313
}

0 commit comments

Comments
 (0)