diff options
author | Will Chandler <wchandler@gitlab.com> | 2022-11-30 19:11:45 +0300 |
---|---|---|
committer | Will Chandler <wchandler@gitlab.com> | 2022-11-30 19:13:01 +0300 |
commit | 594c29414c367a2176b8158fea734b7d9b10f3ec (patch) | |
tree | 9ab18e943c86a1e95a2b427106cf38ec6a9500dd /cmd | |
parent | feee635a4481c884f1aae8093487360772d7c61c (diff) |
Revert "Revert "Merge branch 'wc/user-commit-files-structured-errors' into 'master'""
This reverts commit 52c5d3444a671264cda5b5725fb94e626a400a21.
Reintroduce the changes originally merged with MR 4988 that were
subsequently reverted.
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gitaly-git2go/commit/change_file_mode.go | 2 | ||||
-rw-r--r-- | cmd/gitaly-git2go/commit/commit.go | 2 | ||||
-rw-r--r-- | cmd/gitaly-git2go/commit/move_file.go | 2 | ||||
-rw-r--r-- | cmd/gitaly-git2go/commit/update_file.go | 2 | ||||
-rw-r--r-- | cmd/gitaly-git2go/commit/validate.go | 6 |
5 files changed, 7 insertions, 7 deletions
diff --git a/cmd/gitaly-git2go/commit/change_file_mode.go b/cmd/gitaly-git2go/commit/change_file_mode.go index 94f1490c7..978ed7005 100644 --- a/cmd/gitaly-git2go/commit/change_file_mode.go +++ b/cmd/gitaly-git2go/commit/change_file_mode.go @@ -11,7 +11,7 @@ func applyChangeFileMode(action git2go.ChangeFileMode, index *git.Index) error { entry, err := index.EntryByPath(action.Path, 0) if err != nil { if git.IsErrorCode(err, git.ErrorCodeNotFound) { - return git2go.FileNotFoundError(action.Path) + return git2go.IndexError{Type: git2go.ErrFileNotFound, Path: action.Path} } return err diff --git a/cmd/gitaly-git2go/commit/commit.go b/cmd/gitaly-git2go/commit/commit.go index b8360b44a..aca7af7fc 100644 --- a/cmd/gitaly-git2go/commit/commit.go +++ b/cmd/gitaly-git2go/commit/commit.go @@ -65,7 +65,7 @@ func commit(ctx context.Context, request git2go.CommitCommand) (string, error) { for _, action := range request.Actions { if err := apply(action, repo, index); err != nil { if git.IsErrorClass(err, git.ErrorClassIndex) { - err = git2go.IndexError(err.Error()) + err = git2go.UnknownIndexError(err.Error()) } return "", fmt.Errorf("apply action %T: %w", action, err) diff --git a/cmd/gitaly-git2go/commit/move_file.go b/cmd/gitaly-git2go/commit/move_file.go index 0a24e99cb..e0bd0742e 100644 --- a/cmd/gitaly-git2go/commit/move_file.go +++ b/cmd/gitaly-git2go/commit/move_file.go @@ -11,7 +11,7 @@ func applyMoveFile(action git2go.MoveFile, index *git.Index) error { entry, err := index.EntryByPath(action.Path, 0) if err != nil { if git.IsErrorCode(err, git.ErrorCodeNotFound) { - return git2go.FileNotFoundError(action.Path) + return git2go.IndexError{Type: git2go.ErrFileNotFound, Path: action.Path} } return err diff --git a/cmd/gitaly-git2go/commit/update_file.go b/cmd/gitaly-git2go/commit/update_file.go index 1827ce865..93eae6d9f 100644 --- a/cmd/gitaly-git2go/commit/update_file.go +++ b/cmd/gitaly-git2go/commit/update_file.go @@ -11,7 +11,7 @@ func applyUpdateFile(action git2go.UpdateFile, index *git.Index) error { entry, err := index.EntryByPath(action.Path, 0) if err != nil { if git.IsErrorCode(err, git.ErrorCodeNotFound) { - return git2go.FileNotFoundError(action.Path) + return git2go.IndexError{Type: git2go.ErrFileNotFound, Path: action.Path} } return err diff --git a/cmd/gitaly-git2go/commit/validate.go b/cmd/gitaly-git2go/commit/validate.go index 83c68d0f9..8bc944f6f 100644 --- a/cmd/gitaly-git2go/commit/validate.go +++ b/cmd/gitaly-git2go/commit/validate.go @@ -12,7 +12,7 @@ import ( func validateFileExists(index *git.Index, path string) error { if _, err := index.Find(path); err != nil { if git.IsErrorCode(err, git.ErrorCodeNotFound) { - return git2go.FileNotFoundError(path) + return git2go.IndexError{Type: git2go.ErrFileNotFound, Path: path} } return err @@ -24,7 +24,7 @@ func validateFileExists(index *git.Index, path string) error { func validateFileDoesNotExist(index *git.Index, path string) error { _, err := index.Find(path) if err == nil { - return git2go.FileExistsError(path) + return git2go.IndexError{Type: git2go.ErrFileExists, Path: path} } if !git.IsErrorCode(err, git.ErrorCodeNotFound) { @@ -37,7 +37,7 @@ func validateFileDoesNotExist(index *git.Index, path string) error { func validateDirectoryDoesNotExist(index *git.Index, path string) error { _, err := index.FindPrefix(path + string(os.PathSeparator)) if err == nil { - return git2go.DirectoryExistsError(path) + return git2go.IndexError{Type: git2go.ErrDirectoryExists, Path: path} } if !git.IsErrorCode(err, git.ErrorCodeNotFound) { |