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

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2022-02-21 21:46:07 +0300
committerJunio C Hamano <gitster@pobox.com>2022-02-24 00:36:26 +0300
commit45c2fcc2a0659e42c7e4f21f0b97393df261ca51 (patch)
tree310a0c84d44b04f2c04580588c51246d3a239df3 /reftable/writer.c
parent140765911050d62a23503972ef6513ef18252ad3 (diff)
reftable: avoid writing empty keys at the block layer
The public interface (reftable_writer) already ensures that keys are written in strictly increasing order, and an empty key by definition fails this check. However, by also enforcing this at the block layer, it is easier to verify that records (which are written into blocks) never have to consider the possibility of empty keys. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reftable/writer.c')
-rw-r--r--reftable/writer.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/reftable/writer.c b/reftable/writer.c
index 944c2329ab..d54215a50d 100644
--- a/reftable/writer.c
+++ b/reftable/writer.c
@@ -240,14 +240,13 @@ static int writer_add_record(struct reftable_writer *w,
writer_reinit_block_writer(w, reftable_record_type(rec));
err = block_writer_add(w->block_writer, rec);
- if (err < 0) {
+ if (err == -1) {
/* we are writing into memory, so an error can only mean it
* doesn't fit. */
err = REFTABLE_ENTRY_TOO_BIG_ERROR;
goto done;
}
- err = 0;
done:
strbuf_release(&key);
return err;