commit - 95b631b25683415ef380e22998436c28ad3e34c0
commit + a41a7d4af7426fd81c7dcb8b98dae1c7d9ea9acd
blob - a4d19987c878bbc0be5a08026bc1ba88bf3a3f11
blob + 400bb753d71571f27a4b7c68c143f3aee2209b84
--- gotd/repo_imsg.c
+++ gotd/repo_imsg.c
char hex[SHA1_DIGEST_STRING_LENGTH];
if (log_getverbose() > 0 &&
- got_sha1_digest_to_str(id->sha1, hex, sizeof(hex)))
+ got_sha1_digest_to_str(id->hash, hex, sizeof(hex)))
log_debug("sending ACK for %s", hex);
memset(&iack, 0, sizeof(iack));
- memcpy(iack.object_id, id->sha1, SHA1_DIGEST_LENGTH);
+ memcpy(iack.object_id, id->hash, SHA1_DIGEST_LENGTH);
if (imsg_compose(ibuf, GOTD_IMSG_ACK, peerid, pid, -1,
&iack, sizeof(iack)) == -1) {
char hex[SHA1_DIGEST_STRING_LENGTH];
if (log_getverbose() > 0 &&
- got_sha1_digest_to_str(id->sha1, hex, sizeof(hex)))
+ got_sha1_digest_to_str(id->hash, hex, sizeof(hex)))
log_debug("sending NAK for %s", hex);
memset(&inak, 0, sizeof(inak));
- memcpy(inak.object_id, id->sha1, SHA1_DIGEST_LENGTH);
+ memcpy(inak.object_id, id->hash, SHA1_DIGEST_LENGTH);
if (imsg_compose(ibuf, GOTD_IMSG_NAK, peerid, pid, -1,
&inak, sizeof(inak)) == -1) {
blob - cbafb6f84a7a227fce20c6b4bceaf2d79bdba2d2
blob + d669ac33576178f13600531c2ca6a4de6959377e
--- gotd/repo_read.c
+++ gotd/repo_read.c
memset(&isymref, 0, sizeof(isymref));
isymref.name_len = strlen(refname);
isymref.target_len = strlen(target);
- memcpy(isymref.target_id, target_id->sha1, sizeof(isymref.target_id));
+ memcpy(isymref.target_id, target_id->hash, sizeof(isymref.target_id));
len = sizeof(isymref) + isymref.name_len + isymref.target_len;
if (len > MAX_IMSGSIZE - IMSG_HEADER_SIZE) {
}
/* Keep in sync with struct gotd_imsg_ref definition. */
- if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1) {
+ if (imsg_add(wbuf, id->hash, SHA1_DIGEST_LENGTH) == -1) {
err = got_error_from_errno("imsg_add REF");
goto done;
}
}
/* Keep in sync with struct gotd_imsg_ref definition. */
- if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1)
+ if (imsg_add(wbuf, id->hash, SHA1_DIGEST_LENGTH) == -1)
return got_error_from_errno("imsg_add REF");
if (imsg_add(wbuf, &namelen, sizeof(namelen)) == -1)
return got_error_from_errno("imsg_add REF");
memcpy(&iwant, imsg->data, sizeof(iwant));
memset(&id, 0, sizeof(id));
- memcpy(id.sha1, iwant.object_id, SHA1_DIGEST_LENGTH);
+ memcpy(id.hash, iwant.object_id, SHA1_DIGEST_LENGTH);
if (log_getverbose() > 0 &&
- got_sha1_digest_to_str(id.sha1, hex, sizeof(hex)))
+ got_sha1_digest_to_str(id.hash, hex, sizeof(hex)))
log_debug("client wants %s", hex);
imsg_init(&ibuf, client->fd);
memcpy(&ihave, imsg->data, sizeof(ihave));
memset(&id, 0, sizeof(id));
- memcpy(id.sha1, ihave.object_id, SHA1_DIGEST_LENGTH);
+ memcpy(id.hash, ihave.object_id, SHA1_DIGEST_LENGTH);
if (log_getverbose() > 0 &&
- got_sha1_digest_to_str(id.sha1, hex, sizeof(hex)))
+ got_sha1_digest_to_str(id.hash, hex, sizeof(hex)))
log_debug("client has %s", hex);
imsg_init(&ibuf, client->fd);
blob - 9534a8dc0cbb055298ed2df9da2f4cc08ae9ad9f
blob + 71b8bbd363846bb481de5fd0914e2ca2e239ef34
--- gotd/repo_write.c
+++ gotd/repo_write.c
}
/* Keep in sync with struct gotd_imsg_ref definition. */
- if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1) {
+ if (imsg_add(wbuf, id->hash, SHA1_DIGEST_LENGTH) == -1) {
err = got_error_from_errno("imsg_add REF");
goto done;
}
}
/* Keep in sync with struct gotd_imsg_ref definition. */
- if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1)
+ if (imsg_add(wbuf, id->hash, SHA1_DIGEST_LENGTH) == -1)
return got_error_from_errno("imsg_add REF");
if (imsg_add(wbuf, &namelen, sizeof(namelen)) == -1)
return got_error_from_errno("imsg_add REF");
goto done;
}
- memcpy(ref_update->old_id.sha1, iref.old_id, SHA1_DIGEST_LENGTH);
- memcpy(ref_update->new_id.sha1, iref.new_id, SHA1_DIGEST_LENGTH);
+ memcpy(ref_update->old_id.hash, iref.old_id, SHA1_DIGEST_LENGTH);
+ memcpy(ref_update->new_id.hash, iref.new_id, SHA1_DIGEST_LENGTH);
err = got_ref_open(&ref, repo_write.repo, refname, 0);
if (err) {
repo_write.pid);
ref_update->ref = ref;
- if (memcmp(ref_update->new_id.sha1, zero_id, sizeof(zero_id)) == 0) {
+ if (memcmp(ref_update->new_id.hash, zero_id, sizeof(zero_id)) == 0) {
ref_update->delete_ref = 1;
client->nref_del++;
}
size_t len;
memset(&iref, 0, sizeof(iref));
- memcpy(iref.old_id, ref_update->old_id.sha1, SHA1_DIGEST_LENGTH);
- memcpy(iref.new_id, ref_update->new_id.sha1, SHA1_DIGEST_LENGTH);
+ memcpy(iref.old_id, ref_update->old_id.hash, SHA1_DIGEST_LENGTH);
+ memcpy(iref.new_id, ref_update->new_id.hash, SHA1_DIGEST_LENGTH);
iref.ref_is_new = ref_update->ref_is_new;
iref.delete_ref = ref_update->delete_ref;
iref.client_id = client->id;
blob - 8f00f2699c2d87d84a815df4188c27ed9fcc45c0
blob + 1e9bf9d8ca59c38661286e87f5efd24e2e8f3a47
--- gotd/session.c
+++ gotd/session.c
if (err)
goto done;
- memcpy(old_id.sha1, iref.old_id, SHA1_DIGEST_LENGTH);
- memcpy(new_id.sha1, iref.new_id, SHA1_DIGEST_LENGTH);
+ memcpy(old_id.hash, iref.old_id, SHA1_DIGEST_LENGTH);
+ memcpy(new_id.hash, iref.new_id, SHA1_DIGEST_LENGTH);
err = got_object_open(&obj, repo,
iref.delete_ref ? &old_id : &new_id);
if (err)
blob - 7941cebcee734db2de13f407678a3b740f02ca32
blob + eec49fff02579b61fd3d35f81f6eb23e587eaa85
--- include/got_object.h
+++ include/got_object.h
};
struct got_object_id {
- u_int8_t sha1[SHA1_DIGEST_LENGTH];
+ u_int8_t hash[SHA1_DIGEST_LENGTH];
};
struct got_blob_object;
blob - d8bb60c6ff7c54513bc631ba36c3348e3ebe1788
blob + 8d5f8fd14fff204077d2cd4a0331172539711a6f
--- lib/fetch.c
+++ lib/fetch.c
err = got_privsep_recv_fetch_progress(&done,
&id, &refname, symrefs, &server_progress,
- &packfile_size_cur, (*pack_hash)->sha1, &fetchibuf);
+ &packfile_size_cur, (*pack_hash)->hash, &fetchibuf);
if (err != NULL)
goto done;
/* Don't report size progress for an empty pack file. */
err = got_error_from_errno("dup");
goto done;
}
- err = got_privsep_send_index_pack_req(&idxibuf, (*pack_hash)->sha1,
+ err = got_privsep_send_index_pack_req(&idxibuf, (*pack_hash)->hash,
npackfd);
if (err != NULL)
goto done;
blob - 8d63257a31ec340aa4c23346b7148d5331d4c107
blob + 60f97ae775a8f935216bfb3dc42d6489c9577044
--- lib/fileindex.c
+++ lib/fileindex.c
struct got_fileindex_entry *ie)
{
memset(id, 0, sizeof(*id));
- memcpy(id->sha1, ie->staged_blob_sha1, sizeof(ie->staged_blob_sha1));
+ memcpy(id->hash, ie->staged_blob_sha1, sizeof(ie->staged_blob_sha1));
return id;
}
struct got_fileindex_entry *ie)
{
memset(id, 0, sizeof(*id));
- memcpy(id->sha1, ie->blob_sha1, sizeof(ie->blob_sha1));
+ memcpy(id->hash, ie->blob_sha1, sizeof(ie->blob_sha1));
return id;
}
struct got_fileindex_entry *ie)
{
memset(id, 0, sizeof(*id));
- memcpy(id->sha1, ie->commit_sha1, sizeof(ie->commit_sha1));
+ memcpy(id->hash, ie->commit_sha1, sizeof(ie->commit_sha1));
return id;
}
blob - 188c28e9e67bdc37146176e911d6226b223c40d2
blob + efa475c109e9d2c29e6513913f23b931c3c49b42
--- lib/got_lib_pack.h
+++ lib/got_lib_pack.h
} __attribute__((__packed__));
struct got_packidx_object_id {
- u_int8_t sha1[SHA1_DIGEST_LENGTH];
+ u_int8_t hash[SHA1_DIGEST_LENGTH];
} __attribute__((__packed__));
/* Ignore pack index version 1 which is no longer written by Git. */
blob - f8b902a4c27338568c455eb639ecba5cbb38b8c2
blob + 6ce635e299cfb8a3b1d2cc29df47893282d7e9e6
--- lib/object.c
+++ lib/object.c
goto done;
if (asprintf(path, "%s/%.2x/%s", path_objects,
- id->sha1[0], hex + 2) == -1)
+ id->hash[0], hex + 2) == -1)
err = got_error_from_errno("asprintf");
done:
{
struct got_object_id id;
- if (!got_parse_sha1_digest(id.sha1, id_str))
+ if (!got_parse_sha1_digest(id.hash, id_str))
return got_error_path(id_str, GOT_ERR_BAD_OBJ_ID_STR);
return got_object_open(obj, repo, &id);
blob - d703aefd6b522073c9b2c3c3eb7f2cff2a4e3590
blob + 245107563b79be5b6697f5bf26b4135c01f0ce14
--- lib/object_create.c
+++ lib/object_create.c
err = got_error_from_errno("calloc");
goto done;
}
- SHA1Final((*id)->sha1, &sha1_ctx);
+ SHA1Final((*id)->hash, &sha1_ctx);
if (fflush(*blobfile) != 0) {
err = got_error_from_errno("fflush");
treesize += n;
len = SHA1_DIGEST_LENGTH;
- n = fwrite(te->id.sha1, 1, len, treefile);
+ n = fwrite(te->id.hash, 1, len, treefile);
if (n != len) {
err = got_ferror(treefile, GOT_ERR_IO);
goto done;
}
- SHA1Update(&sha1_ctx, te->id.sha1, len);
+ SHA1Update(&sha1_ctx, te->id.hash, len);
treesize += n;
}
err = got_error_from_errno("calloc");
goto done;
}
- SHA1Final((*id)->sha1, &sha1_ctx);
+ SHA1Final((*id)->hash, &sha1_ctx);
if (fflush(treefile) != 0) {
err = got_error_from_errno("fflush");
err = got_error_from_errno("calloc");
goto done;
}
- SHA1Final((*id)->sha1, &sha1_ctx);
+ SHA1Final((*id)->hash, &sha1_ctx);
if (fflush(commitfile) != 0) {
err = got_error_from_errno("fflush");
err = got_error_from_errno("calloc");
goto done;
}
- SHA1Final((*id)->sha1, &sha1_ctx);
+ SHA1Final((*id)->hash, &sha1_ctx);
if (fflush(tagfile) != 0) {
err = got_error_from_errno("fflush");
blob - 103067d7de3a1d7703e09e80cf6385c016733b27
blob + 45b6543107fec7f696e629209988e4f1ee48d628
--- lib/object_idset.c
+++ lib/object_idset.c
static uint64_t
idset_hash(struct got_object_idset *set, struct got_object_id *id)
{
- return SipHash24(&set->key, id->sha1, sizeof(id->sha1));
+ return SipHash24(&set->key, id->hash, sizeof(id->hash));
}
static const struct got_error *
blob - 0d4231ebe983b9f0f36e32dc6ea4cfa217100d03
blob + dece96df83ffd3846c7dbb45a31b59171112c076
--- lib/object_open_io.c
+++ lib/object_open_io.c
err = got_error(GOT_ERR_NO_SPACE);
goto done;
}
- memcpy(te->id.sha1, pe->id, SHA1_DIGEST_LENGTH);
+ memcpy(te->id.hash, pe->id, SHA1_DIGEST_LENGTH);
te->mode = pe->mode;
te->idx = i;
}
blob - a5bc20986b8717cb89c1b8dbaf04600d65a17802
blob + 85cda810ac9020610cbd80274138c726f819350c
--- lib/object_parse.c
+++ lib/object_parse.c
got_object_id_cmp(const struct got_object_id *id1,
const struct got_object_id *id2)
{
- return memcmp(id1->sha1, id2->sha1, SHA1_DIGEST_LENGTH);
+ return memcmp(id1->hash, id2->hash, SHA1_DIGEST_LENGTH);
}
const struct got_error *
char *
got_object_id_hex(struct got_object_id *id, char *buf, size_t len)
{
- return got_sha1_digest_to_str(id->sha1, buf, len);
+ return got_sha1_digest_to_str(id->hash, buf, len);
}
void
}
got_hash_final(&ctx, hash);
- if (got_hash_cmp(&ctx, expected_id->sha1, hash) != 0) {
+ if (got_hash_cmp(&ctx, expected_id->hash, hash) != 0) {
err = got_error_checksum(expected_id);
goto done;
}
if (err)
return err;
- if (!got_parse_sha1_digest(qid->id.sha1, id_str)) {
+ if (!got_parse_sha1_digest(qid->id.hash, id_str)) {
err = got_error(GOT_ERR_BAD_OBJ_DATA);
got_object_qid_free(qid);
return err;
goto done;
}
s += label_len;
- if (!got_parse_hash_digest((*commit)->tree_id->sha1, s, algo)) {
+ if (!got_parse_hash_digest((*commit)->tree_id->hash, s, algo)) {
err = got_error(GOT_ERR_BAD_OBJ_DATA);
goto done;
}
if (err)
return err;
- got_hash_final(&ctx, id.sha1);
+ got_hash_final(&ctx, id.hash);
if (got_object_id_cmp(expected_id, &id) != 0) {
err = got_error_checksum(expected_id);
goto done;
if (err)
return err;
- got_hash_final(&ctx, id.sha1);
+ got_hash_final(&ctx, id.hash);
if (got_object_id_cmp(expected_id, &id) != 0) {
err = got_error_checksum(expected_id);
goto done;
goto done;
}
s += label_len;
- if (!got_parse_hash_digest((*tag)->id.sha1, s, algo)) {
+ if (!got_parse_hash_digest((*tag)->id.hash, s, algo)) {
err = got_error(GOT_ERR_BAD_OBJ_DATA);
goto done;
}
if (err)
return err;
- got_hash_final(&ctx, id.sha1);
+ got_hash_final(&ctx, id.hash);
if (got_object_id_cmp(expected_id, &id) != 0) {
err = got_error_checksum(expected_id);
goto done;
blob - 49c486d59d228e9e64cdacaa00c1cdbcd30296d7
blob + 2aa8a2b9cffabc5d5bde4b290258cfe254992bac
--- lib/pack.c
+++ lib/pack.c
got_packidx_get_object_idx(struct got_packidx *packidx,
struct got_object_id *id)
{
- u_int8_t id0 = id->sha1[0];
+ u_int8_t id0 = id->hash[0];
uint32_t totobj = be32toh(packidx->hdr.fanout_table[0xff]);
int left = 0, right = totobj - 1;
i = ((left + right) / 2);
oid = &packidx->hdr.sorted_ids[i];
- cmp = memcmp(id->sha1, oid->sha1, SHA1_DIGEST_LENGTH);
+ cmp = memcmp(id->hash, oid->hash, SHA1_DIGEST_LENGTH);
if (cmp == 0)
return i;
else if (cmp > 0)
return got_error(GOT_ERR_NO_OBJ);
oid = &packidx->hdr.sorted_ids[idx];
- memcpy(id->sha1, oid->sha1, SHA1_DIGEST_LENGTH);
+ memcpy(id->hash, oid->hash, SHA1_DIGEST_LENGTH);
return NULL;
}
if (id0 > 0)
i = be32toh(packidx->hdr.fanout_table[id0 - 1]);
oid = &packidx->hdr.sorted_ids[i];
- while (i < totobj && oid->sha1[0] == id0) {
+ while (i < totobj && oid->hash[0] == id0) {
char id_str[GOT_OBJECT_ID_HEX_MAXLEN];
struct got_object_qid *qid;
int cmp;
- if (!got_hash_digest_to_str(oid->sha1, id_str, sizeof(id_str),
+ if (!got_hash_digest_to_str(oid->hash, id_str, sizeof(id_str),
algo))
return got_error(GOT_ERR_NO_SPACE);
err = got_object_qid_alloc_partial(&qid);
if (err)
break;
- memcpy(qid->id.sha1, oid->sha1, SHA1_DIGEST_LENGTH);
+ memcpy(qid->id.hash, oid->hash, SHA1_DIGEST_LENGTH);
STAILQ_INSERT_TAIL(matched_ids, qid, entry);
oid = &packidx->hdr.sorted_ids[++i];
blob - 8ada11b2e7b11cd4b1a0a33f8e42fa324adfcd04
blob + 5fe3a143b937f5d9546cfeb56eacda0494beb68a
--- lib/pack_create.c
+++ lib/pack_create.c
if (err)
return err;
*packfile_size += nh;
- err = hwrite(packfd, m->prev->id.sha1,
- sizeof(m->prev->id.sha1), ctx);
+ err = hwrite(packfd, m->prev->id.hash,
+ sizeof(m->prev->id.hash), ctx);
if (err)
return err;
- *packfile_size += sizeof(m->prev->id.sha1);
+ *packfile_size += sizeof(m->prev->id.hash);
}
return NULL;
blob - d7107177f8056953e03aac01278c49f2aee6f81f
blob + 5870c50d33ebc831012351325d3c1f891cc564e6
--- lib/pack_index.c
+++ lib/pack_index.c
}
} else
SHA1Update(&ctx, data, datalen);
- SHA1Final(obj->id.sha1, &ctx);
+ SHA1Final(obj->id.hash, &ctx);
free(header);
free(data);
break;
case GOT_OBJ_TYPE_REF_DELTA:
- memset(obj->id.sha1, 0xff, SHA1_DIGEST_LENGTH);
+ memset(obj->id.hash, 0xff, SHA1_DIGEST_LENGTH);
if (pack->map) {
if (mapoff + SHA1_DIGEST_LENGTH >= pack->filesize) {
err = got_error(GOT_ERR_BAD_PACKFILE);
(long long)mapoff + SHA1_DIGEST_LENGTH);
break;
}
- memcpy(obj->delta.ref.ref_id.sha1, pack->map + mapoff,
+ memcpy(obj->delta.ref.ref_id.hash, pack->map + mapoff,
SHA1_DIGEST_LENGTH);
obj->crc = crc32(obj->crc, pack->map + mapoff,
SHA1_DIGEST_LENGTH);
if (err)
break;
} else {
- n = read(pack->fd, obj->delta.ref.ref_id.sha1,
+ n = read(pack->fd, obj->delta.ref.ref_id.hash,
SHA1_DIGEST_LENGTH);
if (n == -1) {
err = got_error_from_errno("read");
err = got_error(GOT_ERR_BAD_PACKFILE);
break;
}
- obj->crc = crc32(obj->crc, obj->delta.ref.ref_id.sha1,
+ obj->crc = crc32(obj->crc, obj->delta.ref.ref_id.hash,
SHA1_DIGEST_LENGTH);
- SHA1Update(pack_sha1_ctx, obj->delta.ref.ref_id.sha1,
+ SHA1Update(pack_sha1_ctx, obj->delta.ref.ref_id.hash,
SHA1_DIGEST_LENGTH);
err = got_inflate_to_mem_fd(NULL, &datalen, &obj->len,
&csum, obj->size, pack->fd);
obj->len += SHA1_DIGEST_LENGTH;
break;
case GOT_OBJ_TYPE_OFFSET_DELTA:
- memset(obj->id.sha1, 0xff, SHA1_DIGEST_LENGTH);
+ memset(obj->id.hash, 0xff, SHA1_DIGEST_LENGTH);
err = got_pack_parse_offset_delta(&obj->delta.ofs.base_offset,
&obj->delta.ofs.base_offsetlen, pack, obj->off,
obj->tslen);
goto done;
} else
SHA1Update(&ctx, buf, len);
- SHA1Final(obj->id.sha1, &ctx);
+ SHA1Final(obj->id.hash, &ctx);
done:
free(buf);
free(header);
i = ((left + right) / 2);
oid = &packidx->hdr.sorted_ids[i];
- cmp = memcmp(sha1, oid->sha1, SHA1_DIGEST_LENGTH);
+ cmp = memcmp(sha1, oid->hash, SHA1_DIGEST_LENGTH);
if (cmp == 0)
return -1; /* object already indexed */
else if (cmp > 0)
fprintf(stderr, "object IDs:\n");
for (i = 0; i < nindexed; i++) {
char hex[SHA1_DIGEST_STRING_LENGTH];
- got_sha1_digest_to_str(packidx->hdr.sorted_ids[i].sha1,
+ got_sha1_digest_to_str(packidx->hdr.sorted_ids[i].hash,
hex, sizeof(hex));
fprintf(stderr, "%s\n", hex);
}
{
int i;
- memcpy(packidx->hdr.sorted_ids[idx].sha1, obj->id.sha1,
+ memcpy(packidx->hdr.sorted_ids[idx].hash, obj->id.hash,
SHA1_DIGEST_LENGTH);
packidx->hdr.crc32[idx] = htobe32(obj->crc);
if (obj->off < GOT_PACKIDX_OFFSET_VAL_IS_LARGE_IDX)
packidx->nlargeobj++;
}
- for (i = obj->id.sha1[0]; i <= 0xff; i++) {
+ for (i = obj->id.hash[0]; i <= 0xff; i++) {
uint32_t n = be32toh(packidx->hdr.fanout_table[i]);
packidx->hdr.fanout_table[i] = htobe32(n + 1);
}
int idx;
uint32_t nindexed = be32toh(packidx->hdr.fanout_table[0xff]);
- idx = find_object_idx(packidx, obj->id.sha1);
+ idx = find_object_idx(packidx, obj->id.hash);
if (idx == -1)
return; /* object already indexed */
blob - 92514335bde2a392e0211cb8f5903c931aac55d2
blob + e6f4a149822160b5f8f31472e5749bb81e9bfa10
--- lib/patch.c
+++ lib/patch.c
return err;
idptr = matched_id;
} else {
- if (!got_parse_sha1_digest(id.sha1, blobid))
+ if (!got_parse_sha1_digest(id.hash, blobid))
return got_error(GOT_ERR_BAD_OBJ_ID_STR);
idptr = &id;
}
err = got_object_tree_find_path(&id, NULL, repo, tree, path);
if (err)
return err;
- got_sha1_digest_to_str(id->sha1, p->blob, sizeof(p->blob));
- got_sha1_digest_to_str(commit_id->sha1, p->cid, sizeof(p->cid));
+ got_sha1_digest_to_str(id->hash, p->blob, sizeof(p->blob));
+ got_sha1_digest_to_str(commit_id->hash, p->cid, sizeof(p->cid));
free(id);
err = open_blob(apath, afile, p->blob, repo);
*do_merge = err == NULL;
blob - caf8324d7d3d913238117b541700ab59021826c4
blob + 50de5ee871e1bce4796e0df633d7d317326f4669
--- lib/privsep.c
+++ lib/privsep.c
te_name = buf + sizeof(ite);
memcpy(te->name, te_name, ite.namelen);
te->name[ite.namelen] = '\0';
- memcpy(te->id.sha1, ite.id, SHA1_DIGEST_LENGTH);
+ memcpy(te->id.hash, ite.id, SHA1_DIGEST_LENGTH);
te->mode = ite.mode;
te->idx = *nentries;
(*nentries)++;
return got_error_from_errno("malloc");
itag = (struct got_imsg_tag_object *)buf;
- memcpy(itag->id, tag->id.sha1, sizeof(itag->id));
+ memcpy(itag->id, tag->id.hash, sizeof(itag->id));
itag->obj_type = tag->obj_type;
itag->tag_len = tag_len;
itag->tagger_len = tagger_len;
break;
}
- memcpy((*tag)->id.sha1, itag->id, SHA1_DIGEST_LENGTH);
+ memcpy((*tag)->id.hash, itag->id, SHA1_DIGEST_LENGTH);
(*tag)->tag = strndup(imsg.data + len, itag->tag_len);
if ((*tag)->tag == NULL) {
if (wbuf == NULL)
return got_error_from_errno(
"imsg_create COMMIT_TRAVERSAL_REQUEST");
- if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1)
+ if (imsg_add(wbuf, id->hash, SHA1_DIGEST_LENGTH) == -1)
return got_error_from_errno("imsg_add "
"COMMIT_TRAVERSAL_REQUEST");
if (imsg_add(wbuf, &idx, sizeof(idx)) == -1)
err = got_object_qid_alloc_partial(&qid);
if (err)
break;
- memcpy(qid->id.sha1, sha1, SHA1_DIGEST_LENGTH);
+ memcpy(qid->id.hash, sha1, SHA1_DIGEST_LENGTH);
STAILQ_INSERT_TAIL(commit_ids, qid, entry);
/* The last commit may contain a change. */
if (wbuf == NULL)
return got_error_from_errno("imsg_create ENUMERATED_TREE");
- if (imsg_add(wbuf, tree_id->sha1, SHA1_DIGEST_LENGTH) == -1)
+ if (imsg_add(wbuf, tree_id->hash, SHA1_DIGEST_LENGTH) == -1)
return got_error_from_errno("imsg_add ENUMERATED_TREE");
if (imsg_add(wbuf, &nentries, sizeof(nentries)) == -1)
return got_error_from_errno("imsg_add ENUMERATED_TREE");
break;
}
icommit = (struct got_imsg_enumerated_commit *)imsg.data;
- memcpy(commit_id.sha1, icommit->id, SHA1_DIGEST_LENGTH);
+ memcpy(commit_id.hash, icommit->id, SHA1_DIGEST_LENGTH);
mtime = icommit->mtime;
have_commit = 1;
break;
err = got_error(GOT_ERR_PRIVSEP_LEN);
break;
}
- memcpy(tree_id.sha1, itree->id, sizeof(tree_id.sha1));
+ memcpy(tree_id.hash, itree->id, sizeof(tree_id.hash));
free(path);
path = strndup(imsg.data + sizeof(*itree), path_len);
if (path == NULL) {
struct got_imsg_commit_painting_request ireq;
memset(&ireq, 0, sizeof(ireq));
- memcpy(ireq.id, id->sha1, sizeof(ireq.id));
+ memcpy(ireq.id, id->hash, sizeof(ireq.id));
ireq.idx = idx;
ireq.color = color;
color = (intptr_t)qid->data;
/* Keep in sync with struct got_imsg_painted_commit! */
- if (imsg_add(wbuf, qid->id.sha1, SHA1_DIGEST_LENGTH) == -1)
+ if (imsg_add(wbuf, qid->id.hash, SHA1_DIGEST_LENGTH) == -1)
return got_error_from_errno("imsg_add PAINTED_COMMITS");
if (imsg_add(wbuf, &color, sizeof(color)) == -1)
return got_error_from_errno("imsg_add PAINTED_COMMITS");
if (icommits.present_in_pack) {
struct got_object_id id;
- memcpy(id.sha1, icommit.id, SHA1_DIGEST_LENGTH);
+ memcpy(id.hash, icommit.id, SHA1_DIGEST_LENGTH);
err = cb(cb_arg, &id, icommit.color);
if (err)
break;
err = got_object_qid_alloc_partial(&qid);
if (err)
break;
- memcpy(qid->id.sha1, icommit.id,
+ memcpy(qid->id.hash, icommit.id,
SHA1_DIGEST_LENGTH);
qid->data = (void *)icommit.color;
STAILQ_INSERT_TAIL(new_ids, qid, entry);
blob - 47ff224bf7a9abf8dc6dbf39d3b8c6eb7c173a02
blob + 153649083be68fbacb30ebb82575b58f1020bc81
--- lib/reference.c
+++ lib/reference.c
return parse_symref(ref, name, line);
}
- if (!got_parse_hash_digest(id.sha1, line, algo))
+ if (!got_parse_hash_digest(id.hash, line, algo))
return got_error(GOT_ERR_BAD_REF_DATA);
return alloc_ref(ref, name, &id, 0, mtime);
if (line[0] == '#' || line[0] == '^')
return NULL;
- if (!got_parse_hash_digest(id.sha1, line, algo))
+ if (!got_parse_hash_digest(id.hash, line, algo))
return got_error(GOT_ERR_BAD_REF_DATA);
if (abs_refname) {
blob - f6ac7c86bcf7794ce925c45451471441e0d4827c
blob + a1c5c2856e555e0180042bbcf838e6e61f6814ea
--- lib/repository.c
+++ lib/repository.c
bf = get_packidx_bloom_filter(repo, path_packidx, strlen(path_packidx));
if (bf)
- return bloom_check(bf->bloom, id->sha1, sizeof(id->sha1));
+ return bloom_check(bf->bloom, id->hash, sizeof(id->hash));
/* No bloom filter means this pack index must be searched. */
return 1;
for (i = 0; i < nobjects; i++) {
struct got_packidx_object_id *id;
id = &packidx->hdr.sorted_ids[i];
- bloom_add(bf->bloom, id->sha1, sizeof(id->sha1));
+ bloom_add(bf->bloom, id->hash, sizeof(id->hash));
}
RB_INSERT(got_packidx_bloom_filter_tree,
goto done;
}
- if (!got_parse_hash_digest(id.sha1, id_str, repo->algo))
+ if (!got_parse_hash_digest(id.hash, id_str, repo->algo))
continue;
/*
goto done;
}
- if (!got_parse_hash_digest(id.sha1, id_str,
+ if (!got_parse_hash_digest(id.hash, id_str,
repo->algo)) {
free(id_str);
continue;
blob - 97e7b226b771d2d7ddd6567ff605c8dcda2097b7
blob + 522c3393ca3e3bce08a4efda7994f68d175a30b1
--- lib/repository_admin.c
+++ lib/repository_admin.c
goto done;
}
- err = got_pack_create((*pack_hash)->sha1, packfd, delta_cache,
+ err = got_pack_create((*pack_hash)->hash, packfd, delta_cache,
theirs, ntheirs, ours, nours, repo, loose_obj_only, 0,
progress_cb, progress_arg, &rl, cancel_cb, cancel_arg);
if (err)
err = got_error_from_errno("dup");
goto done;
}
- err = got_privsep_send_index_pack_req(&idxibuf, pack_hash->sha1,
+ err = got_privsep_send_index_pack_req(&idxibuf, pack_hash->hash,
npackfd);
if (err != NULL)
goto done;
goto done;
}
*dot = '\0';
- if (!got_parse_sha1_digest(id.sha1, p)) {
+ if (!got_parse_sha1_digest(id.hash, p)) {
err = got_error_fmt(GOT_ERR_BAD_PATH,
"'%s' is not a valid pack file name",
packfile_name);
break;
}
oid = &packidx->hdr.sorted_ids[i];
- memcpy(id.sha1, oid->sha1, SHA1_DIGEST_LENGTH);
+ memcpy(id.hash, oid->hash, SHA1_DIGEST_LENGTH);
offset = got_packidx_get_object_offset(packidx, i);
if (offset == -1) {
}
memset(&id, 0, sizeof(id));
- if (!got_parse_sha1_digest(id.sha1, id_str)) {
+ if (!got_parse_sha1_digest(id.hash, id_str)) {
free(id_str);
continue;
}
blob - 1b01d8f8ee6aa52241e5cbb76dc271482859bc00
blob + 85fbf48e6dbd6c3e6a2ebe1311daa8a61a0aa5a1
--- lib/worktree.c
+++ lib/worktree.c
return err;
err = got_fileindex_entry_update(new_ie, wt_fd, path,
- blob_id->sha1, base_commit_id->sha1, 1);
+ blob_id->hash, base_commit_id->hash, 1);
if (err)
goto done;
* updating contents of this file.
*/
if (got_fileindex_entry_has_commit(ie) &&
- memcmp(ie->commit_sha1, worktree->base_commit_id->sha1,
+ memcmp(ie->commit_sha1, worktree->base_commit_id->hash,
SHA1_DIGEST_LENGTH) == 0) {
/* Same commit. */
err = sync_timestamps(worktree->root_fd,
goto done;
}
if (got_fileindex_entry_has_blob(ie) &&
- memcmp(ie->blob_sha1, te->id.sha1,
+ memcmp(ie->blob_sha1, te->id.hash,
SHA1_DIGEST_LENGTH) == 0) {
/* Different commit but the same blob. */
err = sync_timestamps(worktree->root_fd,
* unmodified files again.
*/
err = got_fileindex_entry_update(ie, worktree->root_fd, path,
- blob->id.sha1, worktree->base_commit_id->sha1,
+ blob->id.hash, worktree->base_commit_id->hash,
update_timestamps);
} else if (status == GOT_STATUS_MODE_CHANGE) {
err = got_fileindex_entry_update(ie, worktree->root_fd, path,
- blob->id.sha1, worktree->base_commit_id->sha1, 0);
+ blob->id.hash, worktree->base_commit_id->hash, 0);
} else if (status == GOT_STATUS_DELETE) {
err = (*progress_cb)(progress_arg, GOT_STATUS_MERGE, path);
if (err)
goto done;
err = got_fileindex_entry_update(ie, worktree->root_fd, path,
- blob->id.sha1, worktree->base_commit_id->sha1, 0);
+ blob->id.hash, worktree->base_commit_id->hash, 0);
if (err)
goto done;
} else {
if (ie) {
err = got_fileindex_entry_update(ie,
- worktree->root_fd, path, blob->id.sha1,
- worktree->base_commit_id->sha1, 1);
+ worktree->root_fd, path, blob->id.hash,
+ worktree->base_commit_id->hash, 1);
} else {
err = create_fileindex_entry(&ie, fileindex,
worktree->base_commit_id, worktree->root_fd, path,
if (got_fileindex_entry_was_skipped(ie))
return NULL;
- if (memcmp(ie->commit_sha1, a->base_commit_id->sha1,
+ if (memcmp(ie->commit_sha1, a->base_commit_id->hash,
SHA1_DIGEST_LENGTH) == 0)
return NULL;
if (err)
return err;
}
- memcpy(ie->commit_sha1, a->base_commit_id->sha1, SHA1_DIGEST_LENGTH);
+ memcpy(ie->commit_sha1, a->base_commit_id->hash, SHA1_DIGEST_LENGTH);
return NULL;
}
goto done;
if (status == GOT_STATUS_DELETE) {
err = got_fileindex_entry_update(ie,
- a->worktree->root_fd, path2, blob2->id.sha1,
- a->worktree->base_commit_id->sha1, 0);
+ a->worktree->root_fd, path2, blob2->id.hash,
+ a->worktree->base_commit_id->hash, 0);
if (err)
goto done;
}
/* Reject merges into a work tree with mixed base commits. */
if (got_fileindex_entry_has_commit(ie) &&
- memcmp(ie->commit_sha1, worktree->base_commit_id->sha1,
+ memcmp(ie->commit_sha1, worktree->base_commit_id->hash,
SHA1_DIGEST_LENGTH) != 0)
return got_error(GOT_ERR_MIXED_COMMITS);
status == GOT_STATUS_MODE_CHANGE) {
err = got_fileindex_entry_update(ie,
a->worktree->root_fd, relpath,
- blob->id.sha1,
- a->worktree->base_commit_id->sha1, 1);
+ blob->id.hash,
+ a->worktree->base_commit_id->hash, 1);
if (err)
goto done;
}
err = got_fileindex_entry_update(ie,
worktree->root_fd, relpath,
- ct->staged_blob_id->sha1,
- new_base_commit_id->sha1,
+ ct->staged_blob_id->hash,
+ new_base_commit_id->hash,
!have_staged_files);
} else
err = got_fileindex_entry_update(ie,
worktree->root_fd, relpath,
- ct->blob_id->sha1,
- new_base_commit_id->sha1,
+ ct->blob_id->hash,
+ new_base_commit_id->hash,
!have_staged_files);
} else {
err = got_fileindex_entry_alloc(&ie, pe->path);
if (err)
goto done;
err = got_fileindex_entry_update(ie,
- worktree->root_fd, relpath, ct->blob_id->sha1,
- new_base_commit_id->sha1, 1);
+ worktree->root_fd, relpath, ct->blob_id->hash,
+ new_base_commit_id->hash, 1);
if (err) {
got_fileindex_entry_free(ie);
goto done;
char *ondisk_path;
/* Reject rebase of a work tree with mixed base commits. */
- if (memcmp(ie->commit_sha1, a->worktree->base_commit_id->sha1,
+ if (memcmp(ie->commit_sha1, a->worktree->base_commit_id->hash,
SHA1_DIGEST_LENGTH))
return got_error(GOT_ERR_MIXED_COMMITS);
path_content ? path_content : ondisk_path, a->repo);
if (err)
break;
- memcpy(ie->staged_blob_sha1, new_staged_blob_id->sha1,
+ memcpy(ie->staged_blob_sha1, new_staged_blob_id->hash,
SHA1_DIGEST_LENGTH);
if (status == GOT_STATUS_ADD || staged_status == GOT_STATUS_ADD)
stage = GOT_FILEIDX_STAGE_ADD;
goto done;
if (new_staged_blob_id) {
- memcpy(ie->staged_blob_sha1, new_staged_blob_id->sha1,
+ memcpy(ie->staged_blob_sha1, new_staged_blob_id->hash,
SHA1_DIGEST_LENGTH);
} else {
got_fileindex_entry_stage_set(ie, GOT_FILEIDX_STAGE_NONE);
blob - d1e73e2ed1c63a9ba5f476ed5a29c4017a421c39
blob + 7e257b5af05bc5505443956f102845a47d44621e
--- libexec/got-fetch-pack/got-fetch-pack.c
+++ libexec/got-fetch-pack/got-fetch-pack.c
const struct got_error *err;
char *theirs = NULL, *mine = NULL;
- if (!got_parse_sha1_digest(want->sha1, id_str)) {
+ if (!got_parse_sha1_digest(want->hash, id_str)) {
err = got_error(GOT_ERR_BAD_OBJ_ID_STR);
goto done;
}
for (i = 0; i < nref; i++) {
if (got_object_id_cmp(&have[i], &want[i]) == 0)
continue;
- got_sha1_digest_to_str(want[i].sha1, hashstr, sizeof(hashstr));
+ got_sha1_digest_to_str(want[i].hash, hashstr, sizeof(hashstr));
n = snprintf(buf, sizeof(buf), "want %s%s\n", hashstr,
sent_my_capabilites || my_capabilities == NULL ?
"" : my_capabilities);
TAILQ_FOREACH(pe, have_refs, entry) {
struct got_object_id *id = pe->data;
- got_sha1_digest_to_str(id->sha1, hashstr, sizeof(hashstr));
+ got_sha1_digest_to_str(id->hash, hashstr, sizeof(hashstr));
n = snprintf(buf, sizeof(buf), "have %s\n", hashstr);
if (n < 0 || (size_t)n >= sizeof(buf)) {
err = got_error(GOT_ERR_NO_SPACE);
"unexpected message from server");
goto done;
}
- if (!got_parse_sha1_digest(common_id.sha1, buf + 4)) {
+ if (!got_parse_sha1_digest(common_id.hash, buf + 4)) {
err = got_error_msg(GOT_ERR_BAD_PACKET,
"bad object ID in ACK packet from server");
goto done;
blob - 3c3632addec15ad4cda044f1a67ebddc26480865
blob + 91c4b3a6886513f019c967bee323d90699e8d6fb
--- libexec/got-read-blob/got-read-blob.c
+++ libexec/got-read-blob/got-read-blob.c
if (err)
goto done;
}
- got_hash_final(&ctx, id.sha1);
+ got_hash_final(&ctx, id.hash);
if (got_object_id_cmp(&expected_id, &id) != 0) {
err = got_error_checksum(&expected_id);
goto done;
blob - f89155c989d76f4e73e0f8031fae79c29ed15f53
blob + ca7cac34bcd12c5df8c223e410917d4fb6bb151a
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
struct got_object_id id1, id2;
int idx;
- memcpy(id1.sha1, pte1->id, SHA1_DIGEST_LENGTH);
+ memcpy(id1.hash, pte1->id, SHA1_DIGEST_LENGTH);
idx = got_packidx_get_object_idx(packidx, &id1);
if (idx == -1) {
err = got_error_no_obj(&id1);
if (err)
break;
- memcpy(id2.sha1, pte2->id, SHA1_DIGEST_LENGTH);
+ memcpy(id2.hash, pte2->id, SHA1_DIGEST_LENGTH);
idx = got_packidx_get_object_idx(packidx, &id2);
if (idx == -1) {
err = got_error_no_obj(&id2);
for (i = 0; i < ncommits; i++) {
struct got_object_id *id = &commit_ids[i];
- if (imsg_add(wbuf, id->sha1, SHA1_DIGEST_LENGTH) == -1) {
+ if (imsg_add(wbuf, id->hash, SHA1_DIGEST_LENGTH) == -1) {
return got_error_from_errno(
"imsg_add TRAVERSED_COMMITS");
}
}
commit_ids = new;
}
- memcpy(commit_ids[ncommits - 1].sha1, id.sha1,
+ memcpy(commit_ids[ncommits - 1].hash, id.hash,
SHA1_DIGEST_LENGTH);
pid = STAILQ_FIRST(&commit->parent_ids);
}
if (!changed) {
- memcpy(id.sha1, pid->id.sha1, SHA1_DIGEST_LENGTH);
+ memcpy(id.hash, pid->id.hash, SHA1_DIGEST_LENGTH);
got_object_commit_close(commit);
commit = pcommit;
pcommit = NULL;
err = got_object_qid_alloc_partial(&qid);
if (err)
return err;
- memcpy(&qid->id.sha1, tree_id, SHA1_DIGEST_LENGTH);
+ memcpy(&qid->id.hash, tree_id, SHA1_DIGEST_LENGTH);
qid->data = strdup(path);
if (qid->data == NULL) {
err = got_error_from_errno("strdup");
err = got_object_qid_alloc_partial(&eqid);
if (err)
goto done;
- memcpy(eqid->id.sha1, pte->id, sizeof(eqid->id.sha1));
+ memcpy(eqid->id.hash, pte->id, sizeof(eqid->id.hash));
if (got_object_idset_contains(idset, &eqid->id)) {
got_object_qid_free(eqid);
if (datalen != sizeof(ireq))
return got_error(GOT_ERR_PRIVSEP_LEN);
memcpy(&ireq, imsg->data, sizeof(ireq));
- memcpy(id.sha1, ireq.id, SHA1_DIGEST_LENGTH);
+ memcpy(id.hash, ireq.id, SHA1_DIGEST_LENGTH);
err = queue_commit_id(&ids, &id, ireq.color);
if (err)
blob - d1ffc719f8ca4925cb7bf8c3d4e5c8180824fb64
blob + baca0291979ba2ef5ff6c55f19704c125b04cfb0
--- libexec/got-send-pack/got-send-pack.c
+++ libexec/got-send-pack/got-send-pack.c
err = got_error_from_errno("malloc");
goto done;
}
- if (!got_parse_sha1_digest(id->sha1, id_str)) {
+ if (!got_parse_sha1_digest(id->hash, id_str)) {
err = got_error(GOT_ERR_BAD_OBJ_ID_STR);
goto done;
}
goto done;
}
- got_sha1_digest_to_str(their_id->sha1, old_hashstr,
+ got_sha1_digest_to_str(their_id->hash, old_hashstr,
sizeof(old_hashstr));
got_sha1_digest_to_str(zero_id, new_hashstr,
sizeof(new_hashstr));
}
continue;
}
- got_sha1_digest_to_str(their_id->sha1, old_hashstr,
+ got_sha1_digest_to_str(their_id->hash, old_hashstr,
sizeof(old_hashstr));
} else {
got_sha1_digest_to_str(zero_id, old_hashstr,
sizeof(old_hashstr));
}
- got_sha1_digest_to_str(id->sha1, new_hashstr,
+ got_sha1_digest_to_str(id->hash, new_hashstr,
sizeof(new_hashstr));
err = describe_refchange(&n, &sent_my_capabilites,
my_capabilities, buf, sizeof(buf), refname,
blob - 511fd016b578a9308aede2f46618c2b7b6a353c2
blob + 42ee0e11ca38c06f090798d42182c197fcb40c02
--- regress/idset/idset_test.c
+++ regress/idset/idset_test.c
goto done;
}
- if (!got_parse_sha1_digest(id1.sha1, id_str1)) {
+ if (!got_parse_sha1_digest(id1.hash, id_str1)) {
err = got_error(GOT_ERR_BAD_OBJ_ID_STR);
goto done;
}
- if (!got_parse_sha1_digest(id2.sha1, id_str2)) {
+ if (!got_parse_sha1_digest(id2.hash, id_str2)) {
err = got_error(GOT_ERR_BAD_OBJ_ID_STR);
goto done;
}
- if (!got_parse_sha1_digest(id3.sha1, id_str3)) {
+ if (!got_parse_sha1_digest(id3.hash, id_str3)) {
err = got_error(GOT_ERR_BAD_OBJ_ID_STR);
goto done;
}