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>2022-08-05 13:10:43 +0300
committerToon Claes <toon@gitlab.com>2022-08-08 17:49:25 +0300
commit7948dd3c9be963d0f148015975d5a0b54ef2b04a (patch)
tree6749c9b272720f70e92974b51638ae153b9ad90e
parentb731241d770f8cd1e8b81f48d8a011f0383b4b48 (diff)
gittest: Correctly detect if both Content and OID are set
I noticed when none of both fields is set, the user is presented with the error saving "entry cannot have both OID and content". And when both fields are set, no error is given. Fix this by correctly error out when length of both is greater than zero.
-rw-r--r--internal/git/gittest/tree.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/git/gittest/tree.go b/internal/git/gittest/tree.go
index 41194ed72..bf16a23db 100644
--- a/internal/git/gittest/tree.go
+++ b/internal/git/gittest/tree.go
@@ -92,7 +92,7 @@ func WriteTree(t testing.TB, cfg config.Cfg, repoPath string, entries []TreeEntr
t.Fatalf("invalid entry type %q", entry.Mode)
}
- require.True(t, len(entry.OID) > 0 || len(entry.Content) > 0,
+ require.False(t, len(entry.OID) > 0 && len(entry.Content) > 0,
"entry cannot have both OID and content")
require.False(t, len(entry.OID) == 0 && len(entry.Content) == 0,
"entry must have either an OID or content")