git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/4] cache-tree: remove cache_tree_find_path()

From
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Date
Jun 14, 2022, 21:27 UTC
Message-ID
<81d8e2b5fddbc0943f6daa6d8bdb189bb98da57e.1655242070.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1261.git.1655242070.gitgitgadget@gmail.com>
From: Derrick Stolee <derrickstolee@github.com>

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>
---
 cache-tree.c | 27 ---------------------------
 cache-tree.h |  2 --
 2 files changed, 29 deletions(-)
diff --git a/cache-tree.c b/cache-tree.c
index ff794d940fa..56db0b5026b 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -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
diff --git a/cache-tree.h b/cache-tree.h
index f75f8e74dcd..8efeccebfc9 100644
--- a/cache-tree.h
+++ b/cache-tree.h
@@ -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);
 
-- 
gitgitgadget
Previous: Derrick Stolee via GitGitGadgetNext: Derrick Stolee via GitGitGadget
Message 9 of 15 in “Reactions to v2.37.0-rc0 test coverage report”
  1. 0/4 Reactions to v2.37.0-rc0 test coverage reportDerrick Stolee via GitGitGadget, Jun 14, 2022
  2. 1/4 t2107: test 'git update-index --verbose'Derrick Stolee via GitGitGadget, Jun 14, 2022
  3. Eric SunshineJun 15, 2022
  4. Derrick StoleeJun 16, 2022
  5. 2/4 t5329: test 'git gc --cruft' without '--prune=now'Derrick Stolee via GitGitGadget, Jun 14, 2022
  6. Taylor BlauJun 14, 2022
  7. Derrick StoleeJun 15, 2022
  8. 3/4 pack-write: drop always-NULL parameterDerrick Stolee via GitGitGadget, Jun 14, 2022
  9. 4/4 cache-tree: remove cache_tree_find_path()Derrick Stolee via GitGitGadget, Jun 14, 2022
  10. 0/4 Reactions to v2.37.0-rc0 test coverage reportDerrick Stolee via GitGitGadget, Jun 16, 2022
  11. 1/4 t2107: test 'git update-index --verbose'Derrick Stolee via GitGitGadget, Jun 16, 2022
  12. 2/4 t5329: test 'git gc --cruft' without '--prune=now'Derrick Stolee via GitGitGadget, Jun 16, 2022
  13. 3/4 pack-write: drop always-NULL parameterDerrick Stolee via GitGitGadget, Jun 16, 2022
  14. 4/4 cache-tree: remove cache_tree_find_path()Derrick Stolee via GitGitGadget, Jun 16, 2022
  15. Junio C HamanoJun 16, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.