struct reftable_block out = { 0 };
int n;
uint8_t in[] = "hello";
- reftable_buf_add(&buf, in, sizeof(in));
+ check(!reftable_buf_add(&buf, in, sizeof(in)));
block_source_from_buf(&source, &buf);
check_int(block_source_size(&source), ==, 6);
n = block_source_read_block(&source, &out, 0, sizeof(in));
reftable_iterator_destroy(&it);
}
- reftable_buf_addstr(&pastLast, names[N - 1]);
- reftable_buf_addstr(&pastLast, "/");
+ check(!reftable_buf_addstr(&pastLast, names[N - 1]));
+ check(!reftable_buf_addstr(&pastLast, "/"));
err = reftable_reader_init_ref_iterator(reader, &it);
check(!err);
struct reftable_block_source source = { 0 };
struct reftable_reader *reader;
int err;
- reftable_buf_add(&buf, zeros, sizeof(zeros));
+ check(!reftable_buf_add(&buf, zeros, sizeof(zeros)));
block_source_from_buf(&source, &buf);
err = reftable_reader_new(&reader, &source, "file.log");
int n, m;
uint8_t rt_extra;
- reftable_buf_addstr(&last_key, "refs/heads/master");
- reftable_buf_addstr(&key, "refs/tags/bla");
+ check(!reftable_buf_addstr(&last_key, "refs/heads/master"));
+ check(!reftable_buf_addstr(&key, "refs/tags/bla"));
extra = 6;
n = reftable_encode_key(&restart, dest, last_key, key, extra);
check(!restart);
check_int(n, >, 0);
- reftable_buf_addstr(&roundtrip, "refs/heads/master");
+ check(!reftable_buf_addstr(&roundtrip, "refs/heads/master"));
m = reftable_decode_key(&roundtrip, &rt_extra, dest);
check_int(n, ==, m);
check(!reftable_buf_cmp(&key, &roundtrip));
.u.idx.last_key = REFTABLE_BUF_INIT,
},
};
- reftable_buf_addstr(&in[0].u.idx.last_key, "refs/heads/master");
- reftable_buf_addstr(&in[1].u.idx.last_key, "refs/heads/master");
- reftable_buf_addstr(&in[2].u.idx.last_key, "refs/heads/branch");
+ check(!reftable_buf_addstr(&in[0].u.idx.last_key, "refs/heads/master"));
+ check(!reftable_buf_addstr(&in[1].u.idx.last_key, "refs/heads/master"));
+ check(!reftable_buf_addstr(&in[2].u.idx.last_key, "refs/heads/branch"));
check(!reftable_record_equal(&in[0], &in[1], GIT_SHA1_RAWSZ));
check(!reftable_record_cmp(&in[0], &in[1]));
int n, m;
uint8_t extra;
- reftable_buf_addstr(&in.u.idx.last_key, "refs/heads/master");
+ check(!reftable_buf_addstr(&in.u.idx.last_key, "refs/heads/master"));
reftable_record_key(&in, &key);
t_copy(&in);
check_int(st->readers_len, >, 0);
#ifndef GIT_WINDOWS_NATIVE
- reftable_buf_addstr(&scratch, dir);
- reftable_buf_addstr(&scratch, "/tables.list");
+ check(!reftable_buf_addstr(&scratch, dir));
+ check(!reftable_buf_addstr(&scratch, "/tables.list"));
err = stat(scratch.buf, &stat_result);
check(!err);
check_int((stat_result.st_mode & 0777), ==, opts.default_permissions);
reftable_buf_reset(&scratch);
- reftable_buf_addstr(&scratch, dir);
- reftable_buf_addstr(&scratch, "/");
+ check(!reftable_buf_addstr(&scratch, dir));
+ check(!reftable_buf_addstr(&scratch, "/"));
/* do not try at home; not an external API for reftable. */
- reftable_buf_addstr(&scratch, st->readers[0]->name);
+ check(!reftable_buf_addstr(&scratch, st->readers[0]->name));
err = stat(scratch.buf, &stat_result);
check(!err);
check_int((stat_result.st_mode & 0777), ==, opts.default_permissions);
* Adding a new table to the stack should not be impacted by this, even
* though auto-compaction will now fail.
*/
- reftable_buf_addstr(&table_path, dir);
- reftable_buf_addstr(&table_path, "/");
- reftable_buf_addstr(&table_path, st->readers[0]->name);
- reftable_buf_addstr(&table_path, ".lock");
+ check(!reftable_buf_addstr(&table_path, dir));
+ check(!reftable_buf_addstr(&table_path, "/"));
+ check(!reftable_buf_addstr(&table_path, st->readers[0]->name));
+ check(!reftable_buf_addstr(&table_path, ".lock"));
write_file_buf(table_path.buf, "", 0);
ref.update_index = 2;
}
#ifndef GIT_WINDOWS_NATIVE
- reftable_buf_addstr(&path, dir);
- reftable_buf_addstr(&path, "/tables.list");
+ check(!reftable_buf_addstr(&path, dir));
+ check(!reftable_buf_addstr(&path, "/tables.list"));
err = stat(path.buf, &stat_result);
check(!err);
check_int((stat_result.st_mode & 0777), ==, opts.default_permissions);
reftable_buf_reset(&path);
- reftable_buf_addstr(&path, dir);
- reftable_buf_addstr(&path, "/");
+ check(!reftable_buf_addstr(&path, dir));
+ check(!reftable_buf_addstr(&path, "/"));
/* do not try at home; not an external API for reftable. */
- reftable_buf_addstr(&path, st->readers[0]->name);
+ check(!reftable_buf_addstr(&path, st->readers[0]->name));
err = stat(path.buf, &stat_result);
check(!err);
check_int((stat_result.st_mode & 0777), ==, opts.default_permissions);
* size, we expect that auto-compaction will want to compact all of the
* tables. Locking any of the tables will keep it from doing so.
*/
- reftable_buf_addstr(&buf, dir);
- reftable_buf_addstr(&buf, "/");
- reftable_buf_addstr(&buf, st->readers[2]->name);
- reftable_buf_addstr(&buf, ".lock");
+ check(!reftable_buf_addstr(&buf, dir));
+ check(!reftable_buf_addstr(&buf, "/"));
+ check(!reftable_buf_addstr(&buf, st->readers[2]->name));
+ check(!reftable_buf_addstr(&buf, ".lock"));
write_file_buf(buf.buf, "", 0);
/*
check_int(st->merged->readers_len, ==, 3);
/* Lock one of the tables that we're about to compact. */
- reftable_buf_addstr(&buf, dir);
- reftable_buf_addstr(&buf, "/");
- reftable_buf_addstr(&buf, st->readers[1]->name);
- reftable_buf_addstr(&buf, ".lock");
+ check(!reftable_buf_addstr(&buf, dir));
+ check(!reftable_buf_addstr(&buf, "/"));
+ check(!reftable_buf_addstr(&buf, st->readers[1]->name));
+ check(!reftable_buf_addstr(&buf, ".lock"));
write_file_buf(buf.buf, "", 0);
/*
* our old readers. This should trigger a partial reload of the stack,
* where we try to reuse our old readers.
*/
- reftable_buf_addstr(&content, st->readers[0]->name);
- reftable_buf_addstr(&content, "\n");
- reftable_buf_addstr(&content, st->readers[1]->name);
- reftable_buf_addstr(&content, "\n");
- reftable_buf_addstr(&content, "garbage\n");
- reftable_buf_addstr(&table_path, st->list_file);
- reftable_buf_addstr(&table_path, ".lock");
+ check(!reftable_buf_addstr(&content, st->readers[0]->name));
+ check(!reftable_buf_addstr(&content, "\n"));
+ check(!reftable_buf_addstr(&content, st->readers[1]->name));
+ check(!reftable_buf_addstr(&content, "\n"));
+ check(!reftable_buf_addstr(&content, "garbage\n"));
+ check(!reftable_buf_addstr(&table_path, st->list_file));
+ check(!reftable_buf_addstr(&table_path, ".lock"));
write_file_buf(table_path.buf, content.buf, content.len);
err = rename(table_path.buf, st->list_file);
check(!err);