1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-17 22:44:49 +01:00

Merge branch 'jc/cache-tree' into next

* jc/cache-tree:
  cache-tree: a bit more debugging support.
  read-tree: invalidate cache-tree entry when a new index entry is added.
  Fix test-dump-cache-tree in one-tree disappeared case.
This commit is contained in:
Junio C Hamano 2006-05-03 16:17:33 -07:00
commit 7873d984cf
3 changed files with 11 additions and 6 deletions

View file

@ -110,6 +110,10 @@ void cache_tree_invalidate_path(struct cache_tree *it, const char *path)
int namelen; int namelen;
struct cache_tree_sub *down; struct cache_tree_sub *down;
#if DEBUG
fprintf(stderr, "cache-tree invalidate <%s>\n", path);
#endif
if (!it) if (!it)
return; return;
slash = strchr(path, '/'); slash = strchr(path, '/');
@ -335,7 +339,7 @@ static int update_one(struct cache_tree *it,
offset += 20; offset += 20;
#if DEBUG #if DEBUG
fprintf(stderr, "cache-tree %o %.*s\n", fprintf(stderr, "cache-tree update-one %o %.*s\n",
mode, entlen, path + baselen); mode, entlen, path + baselen);
#endif #endif
} }
@ -351,7 +355,7 @@ static int update_one(struct cache_tree *it,
free(buffer); free(buffer);
it->entry_count = i; it->entry_count = i;
#if DEBUG #if DEBUG
fprintf(stderr, "cache-tree (%d ent, %d subtree) %s\n", fprintf(stderr, "cache-tree update-one (%d ent, %d subtree) %s\n",
it->entry_count, it->subtree_nr, it->entry_count, it->subtree_nr,
sha1_to_hex(it->sha1)); sha1_to_hex(it->sha1));
#endif #endif

View file

@ -21,10 +21,9 @@ static int dump_cache_tree(struct cache_tree *it,
int i; int i;
int errs = 0; int errs = 0;
if (!it) if (!it || !ref)
return; /* missing in either */
if (!ref) return 0;
die("internal error");
if (it->entry_count < 0) { if (it->entry_count < 0) {
dump_one(it, pfx, ""); dump_one(it, pfx, "");

View file

@ -446,6 +446,8 @@ static int merged_entry(struct cache_entry *merge, struct cache_entry *old)
invalidate_ce_path(old); invalidate_ce_path(old);
} }
} }
else
invalidate_ce_path(merge);
merge->ce_flags &= ~htons(CE_STAGEMASK); merge->ce_flags &= ~htons(CE_STAGEMASK);
add_cache_entry(merge, ADD_CACHE_OK_TO_ADD); add_cache_entry(merge, ADD_CACHE_OK_TO_ADD);
return 1; return 1;