]> git.ipfire.org Git - thirdparty/git.git/commitdiff
cache-tree: remove cache_tree_find_path()
authorDerrick Stolee <derrickstolee@github.com>
Thu, 16 Jun 2022 13:13:50 +0000 (13:13 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 16 Jun 2022 18:59:56 +0000 (11:59 -0700)
This reverts 080ab56a46 (cache-tree: implement cache_tree_find_path(),
2022-05-23). The cache_tree_find_path() method was never actually called
in the topic that added it. I cannot find any reference to it in any of
my forks, so this appears to not be needed at the moment.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache-tree.c
cache-tree.h

index ff794d940fa724cf4f1ed7683ab7ef98d703ad0c..56db0b5026b675a77a3962802ebf38c083ae107b 100644 (file)
@@ -101,33 +101,6 @@ struct cache_tree_sub *cache_tree_sub(struct cache_tree *it, const char *path)
        return find_subtree(it, path, pathlen, 1);
 }
 
-struct cache_tree *cache_tree_find_path(struct cache_tree *it, const char *path)
-{
-       const char *slash;
-       int namelen;
-       struct cache_tree_sub it_sub = {
-               .cache_tree = it,
-       };
-       struct cache_tree_sub *down = &it_sub;
-
-       while (down) {
-               slash = strchrnul(path, '/');
-               namelen = slash - path;
-               down->cache_tree->entry_count = -1;
-               if (!*slash) {
-                       int pos;
-                       pos = cache_tree_subtree_pos(down->cache_tree, path, namelen);
-                       if (0 <= pos)
-                               return down->cache_tree->down[pos]->cache_tree;
-                       return NULL;
-               }
-               down = find_subtree(it, path, namelen, 0);
-               path = slash + 1;
-       }
-
-       return NULL;
-}
-
 static int do_invalidate_path(struct cache_tree *it, const char *path)
 {
        /* a/b/c
index f75f8e74dcdb86131d90a83b7d8ebd9861839fd2..8efeccebfc9f0bf8c9cfda1aa4ac531108b52650 100644 (file)
@@ -29,8 +29,6 @@ struct cache_tree_sub *cache_tree_sub(struct cache_tree *, const char *);
 
 int cache_tree_subtree_pos(struct cache_tree *it, const char *path, int pathlen);
 
-struct cache_tree *cache_tree_find_path(struct cache_tree *it, const char *path);
-
 void cache_tree_write(struct strbuf *, struct cache_tree *root);
 struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);