Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2021-03-22 16:39:32 +0300
committerToon Claes <toon@gitlab.com>2021-03-23 21:24:37 +0300
commit1c3b37a1df39ec31b2ccd6c73996ce9a9e0abf28 (patch)
treecc08e0900f1d8aec4875baa7bda51859bdfa5644 /internal/git2go
parent4b2cadff3ca07c3bb6cce6749f094da553b70acb (diff)
gitaly-git2go: Return empty error when no changes
When the tree before and after the cherry-pick are the same, it means there's nothing to commit. So in this case return an `EmptyError` instead of building the commit.
Diffstat (limited to 'internal/git2go')
-rw-r--r--internal/git2go/gob.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/git2go/gob.go b/internal/git2go/gob.go
index 7c4ef0554..9f9ff97b4 100644
--- a/internal/git2go/gob.go
+++ b/internal/git2go/gob.go
@@ -31,6 +31,7 @@ var registeredTypes = map[interface{}]struct{}{
FileNotFoundError(""): {},
InvalidArgumentError(""): {},
HasConflictsError{}: {},
+ EmptyError{}: {},
IndexError(""): {},
}
@@ -62,6 +63,14 @@ func (err HasConflictsError) Error() string {
return "could not apply due to conflicts"
}
+// EmptyError indicates the command, for example cherry-pick, did result in no
+// changes, so the result is empty.
+type EmptyError struct{}
+
+func (err EmptyError) Error() string {
+ return "could not apply because the result was empty"
+}
+
// SerializableError returns an error that is Gob serializable.
// Registered types are serialized directly. Unregistered types
// are transformed in to an opaque error using their error message.