aboutsummaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-07 14:59:54 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-07 14:59:54 -0800
commitda165f470ede6540873d33cb8bc2ff8e13c60520 (patch)
treef17582a9b57a806bea9ba48c128b48f681baf692 /cache.h
parentcee2d6ae6379e7c76e602d55ccc1d4babc1979c0 (diff)
downloadgit-da165f470ede6540873d33cb8bc2ff8e13c60520.tar.gz
git-da165f470ede6540873d33cb8bc2ff8e13c60520.tar.xz
unpack-trees.c: prepare for looking ahead in the index
This prepares but does not yet implement a look-ahead in the index entries when traverse-trees.c decides to give us tree entries in an order that does not match what is in the index. A case where a look-ahead in the index is necessary happens when merging branch B into branch A while the index matches the current branch A, using a tree O as their common ancestor, and these three trees looks like this: O A B t t t-i t-i t-i t-j t-j t/1 t/2 The traverse_trees() function gets "t", "t-i" and "t" from trees O, A and B first, and notices that A may have a matching "t" behind "t-i" and "t-j" (indeed it does), and tells A to give that entry instead. After unpacking blob "t" from tree B (as it hasn't changed since O in B and A removed it, it will result in its removal), it descends into directory "t/". The side that walked index in parallel to the tree traversal used to be implemented with one pointer, o->pos, that points at the next index entry to be processed. When this happens, the pointer o->pos still points at "t-i" that is the first entry. We should be able to skip "t-i" and "t-j" and locate "t/1" from the index while the recursive invocation of traverse_trees() walks and match entries found there, and later come back to process "t-i". While that look-ahead is not implemented yet, this adds a flag bit, CE_UNPACKED, to mark the entries in the index that has already been processed. o->pos pointer has been renamed to o->cache_bottom and it points at the first entry that may still need to be processed. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index bf468e523..9a9596386 100644
--- a/cache.h
+++ b/cache.h
@@ -178,6 +178,8 @@ struct cache_entry {
#define CE_HASHED (0x100000)
#define CE_UNHASHED (0x200000)
+#define CE_UNPACKED (0x1000000)
+
/*
* Extended on-disk flags
*/