src/tree-cache.h


Log

Author Commit Date CI Message
Patrick Steinhardt 0c7f49dd 2017-06-30T13:39:01 Make sure to always include "common.h" first Next to including several files, our "common.h" header also declares various macros which are then used throughout the project. As such, we have to make sure to always include this file first in all implementation files. Otherwise, we might encounter problems or even silent behavioural differences due to macros or defines not being defined as they should be. So in fact, our header and implementation files should make sure to always include "common.h" first. This commit does so by establishing a common include pattern. Header files inside of "src" will now always include "common.h" as its first other file, separated by a newline from all the other includes to make it stand out as special. There are two cases for the implementation files. If they do have a matching header file, they will always include this one first, leading to "common.h" being transitively included as first file. If they do not have a matching header file, they instead include "common.h" as first file themselves. This fixes the outlined problems and will become our standard practice for header and source files inside of the "src/" from now on.
Carlos Martín Nieto c2f8b215 2014-09-28T07:00:49 index: write out the tree cache extension Keeping the cache around after read-tree is only one part of the optimisation opportunities. In order to share the cache between program instances, we need to write the TREE extension to the index. Do so, taking the opportunity to rename 'entries' to 'entry_count' to match the name given in the format description. The included test is rather trivial, but works as a sanity check.
Carlos Martín Nieto 46bb0067 2014-07-11T11:52:38 tree-cache: remove the parent pointer This wasn't used. We invalidate based on the full path, so we always go down the tree, never up.
Carlos Martín Nieto 6843cebe 2014-07-10T14:10:39 index: fill the tree cache when reading from a tree When reading from a tree, we know what every tree is going to look like, so we can fill in the tree cache completely, making use of the index for modification of trees a lot quicker.
Carlos Martín Nieto 19c88310 2014-07-10T13:48:13 tree-cache: move to use a pool allocator This simplifies freeing the entries quite a bit; though there aren't that many failure paths right now, introducing filling the cache from a tree will introduce more. This makes sure not to leak memory on errors.
Carlos Martín Nieto d091a9db 2014-07-10T12:21:28 tree-cache: extract the allocation
Ciro Santilli 06280457 2014-09-18T11:53:24 Join typedef and struct definitions in single file.
Russell Belfer 1fa17b5c 2014-03-14T22:01:30 Minor tree cache speedups While I was looking at the conflict cleanup code, I looked over at the tree cache code, since we clear the tree cache for each entry that gets removed and there is some redundancy there. I made some small tweaks to avoid extra calls to strchr and strlen in a few circumstances.
Edward Thomson 359fc2d2 2013-01-08T17:07:25 update copyrights
schu 5e0de328 2012-02-13T17:10:24 Update Copyright header Signed-off-by: schu <schu-github@schulog.org>
Carlos Martín Nieto b183ffe7 2011-07-26T12:26:12 Make tree cache name a flex-array Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 3ba69ba8 2011-08-02T15:27:42 Add git_tree_cache_get Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto 69bffab9 2011-07-26T14:58:32 Add git_tree_cache_invalidate_path Whenever a file is updated in the index, each tree leading towards it needs to be invalidated. Provide the supporting function. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto b4171320 2011-07-26T11:34:54 Move the tree cache functions to their own file Rename git_index_tree to git_tree_cache. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>