summaryrefslogtreecommitdiff
path: root/notes-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-07-02 19:53:02 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-07-02 19:53:02 (GMT)
commit8061ae8b4618d69a67ff6cfb687d7044964d4b04 (patch)
treefd75c5ef40caf10107f15e320bbb9501017ba695 /notes-cache.c
parent95acfc2479967ba5f3e2ddfee1fa2eb89b386c4f (diff)
parent218aa3a6162b80696a82b8745daa38fa826985ae (diff)
downloadgit-8061ae8b4618d69a67ff6cfb687d7044964d4b04.zip
git-8061ae8b4618d69a67ff6cfb687d7044964d4b04.tar.gz
git-8061ae8b4618d69a67ff6cfb687d7044964d4b04.tar.bz2
Merge branch 'jk/commit-buffer-length'
Move "commit->buffer" out of the in-core commit object and keep track of their lengths. Use this to optimize the code paths to validate GPG signatures in commit objects. * jk/commit-buffer-length: reuse cached commit buffer when parsing signatures commit: record buffer length in cache commit: convert commit->buffer to a slab commit-slab: provide a static initializer use get_commit_buffer everywhere convert logmsg_reencode to get_commit_buffer use get_commit_buffer to avoid duplicate code use get_cached_commit_buffer where appropriate provide helpers to access the commit buffer provide a helper to set the commit buffer provide a helper to free commit buffer sequencer: use logmsg_reencode in get_message logmsg_reencode: return const buffer do not create "struct commit" with xcalloc commit: push commit_index update into alloc_commit_node alloc: include any-object allocations in alloc_report replace dangerous uses of strbuf_attach commit_tree: take a pointer/len pair rather than a const strbuf
Diffstat (limited to 'notes-cache.c')
-rw-r--r--notes-cache.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/notes-cache.c b/notes-cache.c
index 97dfd63..c4e9bb7 100644
--- a/notes-cache.c
+++ b/notes-cache.c
@@ -48,7 +48,6 @@ int notes_cache_write(struct notes_cache *c)
{
unsigned char tree_sha1[20];
unsigned char commit_sha1[20];
- struct strbuf msg = STRBUF_INIT;
if (!c || !c->tree.initialized || !c->tree.ref || !*c->tree.ref)
return -1;
@@ -57,9 +56,8 @@ int notes_cache_write(struct notes_cache *c)
if (write_notes_tree(&c->tree, tree_sha1))
return -1;
- strbuf_attach(&msg, c->validity,
- strlen(c->validity), strlen(c->validity) + 1);
- if (commit_tree(&msg, tree_sha1, NULL, commit_sha1, NULL, NULL) < 0)
+ if (commit_tree(c->validity, strlen(c->validity), tree_sha1, NULL,
+ commit_sha1, NULL, NULL) < 0)
return -1;
if (update_ref("update notes cache", c->tree.ref, commit_sha1, NULL,
0, UPDATE_REFS_QUIET_ON_ERR) < 0)