path: root/notes-cache.c
AgeCommit message (Collapse)Author
2010-11-17notes.h/c: Propagate combine_notes_fn return value to add_note() and beyondJohan Herland
The combine_notes_fn functions uses a non-zero return value to indicate failure. However, this return value was converted to a call to die() in note_tree_insert(). Instead, propagate this return value out to add_note(), and return it from there to enable the caller to handle errors appropriately. Existing add_note() callers are updated to die() upon failure, thus preserving the current behaviour. The only exceptions are copy_note() and notes_cache_put() where we are able to propagate the add_note() return value instead. This patch has been improved by the following contributions: - Jonathan Nieder: Future-proof by always checking add_note() return value - Jonathan Nieder: Improve clarity of final if-condition in note_tree_insert() Thanks-to: Jonathan Nieder <> Signed-off-by: Johan Herland <> Signed-off-by: Junio C Hamano <>
2010-04-02introduce notes-cache interfaceJeff King
Notes provide a fast lookup mechanism for data keyed by sha1. This is ideal for caching certain operations, like textconv filters. This patch builds some infrastructure to make it simpler to use notes trees as caches. In particular, caches: 1. don't have arbitrary commit messages. They store a cache validity string in the commit, and clear the tree when the cache validity string changes. 2. don't keep any commit history. The accumulated history of a a cache is just useless cruft. 3. use a looser form of locking for ref updates. If two processes try to write to the cache simultaneously, it is OK if one overwrites the other, losing some changes. It's just a cache, so we will just end up with an extra miss. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>