Skip to content

Commit

Permalink
Ignore unexpected file modes (#573)
Browse files Browse the repository at this point in the history
Correct #549.

The intention was to skip the file with an unexpected mode, but the “nil, nil” return was actually done in a nested function.

Return ErrSkip to escape the nested function, and correctly return “nil, nil” from visitPath, as was intended.
  • Loading branch information
avidrissman committed May 21, 2024
1 parent e74bc3d commit 50b93e0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions go/pkg/cas/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,13 @@ func (u *uploader) visitPath(ctx context.Context, absPath string, info os.FileIn
// Ignore all non-expected modes (e.g. domain sockets as used by git
// fsmonitor).
default:
return nil, nil
return nil, ErrSkip
}
})
if err != nil {
switch {
case errors.Is(err, ErrSkip):
return nil, nil
case err != nil:
return nil, err
}
return cached.(*digested), nil
Expand Down

0 comments on commit 50b93e0

Please sign in to comment.