Skip to content

Commit 2ce9f59

Browse files
committed
grs: print error when there are no files in the staging area
1 parent 7ac91ce commit 2ce9f59

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/actions/Git-NumberedDiff.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ function Git-NumberedDiff {
3232
##############################################################################
3333
function Git-NumberedDiffCached {
3434
if ($args.length -eq 0 -or $args[0] -eq $null) {
35+
if ($global:gitStatusNumbers.stagingArea.length -eq 0) {
36+
Write-Host "Staging area is empty."
37+
return
38+
}
3539
$args = @("0-$($global:gitStatusNumbers.stagingArea.length - 1)")
3640
}
3741

0 commit comments

Comments
 (0)