Merge branch 'jc/cache-tree' into next
authorJunio C Hamano <junkio@cox.net>
Wed, 3 May 2006 23:17:33 +0000 (16:17 -0700)
committerJunio C Hamano <junkio@cox.net>
Wed, 3 May 2006 23:17:33 +0000 (16:17 -0700)
* 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.

cache-tree.c
dump-cache-tree.c
read-tree.c
index e452238ba7db47c08bd732dd425cb3be4c8bd73d..a880c97b38e7d36f2a45a1743e9565cc1e58280d 100644 (file)
@@ -110,6 +110,10 @@ void cache_tree_invalidate_path(struct cache_tree *it, const char *path)
        int namelen;
        struct cache_tree_sub *down;
 
+#if DEBUG
+       fprintf(stderr, "cache-tree invalidate <%s>\n", path);
+#endif
+
        if (!it)
                return;
        slash = strchr(path, '/');
@@ -335,7 +339,7 @@ static int update_one(struct cache_tree *it,
                offset += 20;
 
 #if DEBUG
-               fprintf(stderr, "cache-tree %o %.*s\n",
+               fprintf(stderr, "cache-tree update-one %o %.*s\n",
                        mode, entlen, path + baselen);
 #endif
        }
@@ -351,7 +355,7 @@ static int update_one(struct cache_tree *it,
        free(buffer);
        it->entry_count = i;
 #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,
                sha1_to_hex(it->sha1));
 #endif
index fbea263dd9a37726f7b9e29154d56b26cfe921c2..1ccaf5177318f8765205e192abdffc3336c9aacb 100644 (file)
@@ -21,10 +21,9 @@ static int dump_cache_tree(struct cache_tree *it,
        int i;
        int errs = 0;
 
-       if (!it)
-               return;
-       if (!ref)
-               die("internal error");
+       if (!it || !ref)
+               /* missing in either */
+               return 0;
 
        if (it->entry_count < 0) {
                dump_one(it, pfx, "");
index 66c0120f1352f8edf6ea1afcd037c96b373273a8..067fb95e9d552789e68e087abd9b5cf855690ceb 100644 (file)
@@ -446,6 +446,8 @@ static int merged_entry(struct cache_entry *merge, struct cache_entry *old)
                        invalidate_ce_path(old);
                }
        }
+       else
+               invalidate_ce_path(merge);
        merge->ce_flags &= ~htons(CE_STAGEMASK);
        add_cache_entry(merge, ADD_CACHE_OK_TO_ADD);
        return 1;