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

Re: What's cooking in git.git (Jan 2025, #06; Wed, 22)

From
Jeff King <peff@peff.net>
Date
Jan 23, 2025, 00:36 UTC
Message-ID
<20250123003613.GA3900660@coredump.intra.peff.net>
In-Reply-To
<xmqqbjvyv510.fsf@gitster.g>
On Wed, Jan 22, 2025 at 02:48:43PM -0800, Junio C Hamano wrote:
Show 17 quoted lines
> * ds/path-walk-1 (2024-12-20) 7 commits
>   (merged to 'next' on 2025-01-22 at 3171845b73)
>  + path-walk: reorder object visits
>  + path-walk: mark trees and blobs as UNINTERESTING
>  + path-walk: visit tags and cached objects
>  + path-walk: allow consumer to specify object types
>  + t6601: add helper for testing path-walk API
>  + test-lib-functions: add test_cmp_sorted
>  + path-walk: introduce an object walk by path
>  (this branch is used by ds/backfill.)
> 
>  Introduce a new API to visit objects in batches based on a common
>  path, or by type.
> 
>  Will merge to 'master'.
>  cf. <Z4jeQSLmARruE5l3@pks.im>
>  source: <pull.1818.v4.git.1734711675.gitgitgadget@gmail.com>

Since this hit 'next', it made it into my Coverity runs, producing the small fixup below.

-- >8 --
Subject: [PATCH] path-walk: drop redundant parse_tree() call

This call to parse_tree() was flagged by Coverity for ignoring the return value. But if we look a little further up the function, we can see that there is already a call to parse_tree_gently(), and we'll return early if that fails. So by this point the tree will always be parsed, and the call is redundant.

Signed-off-by: Jeff King <peff@peff.net>
---
 path-walk.c | 1 -
 1 file changed, 1 deletion(-)
diff --git a/path-walk.c b/path-walk.c
index 136ec08fb0..9715a5550e 100644
--- a/path-walk.c
+++ b/path-walk.c
@@ -116,27 +116,26 @@ static int add_tree_entries(struct path_walk_context *ctx,
 
 	if (!tree) {
 		error(_("failed to walk children of tree %s: not found"),
 		      oid_to_hex(oid));
 		return -1;
 	} else if (parse_tree_gently(tree, 1)) {
 		error("bad tree object %s", oid_to_hex(oid));
 		return -1;
 	}
 
 	strbuf_addstr(&path, base_path);
 	base_len = path.len;
 
-	parse_tree(tree);
 	init_tree_desc(&desc, &tree->object.oid, tree->buffer, tree->size);
 	while (tree_entry(&desc, &entry)) {
 		struct type_and_oid_list *list;
 		struct object *o;
 		/* Not actually true, but we will ignore submodules later. */
 		enum object_type type = S_ISDIR(entry.mode) ? OBJ_TREE : OBJ_BLOB;
 
 		/* Skip submodules. */
 		if (S_ISGITLINK(entry.mode))
 			continue;
 
 		/* If the caller doesn't want blobs, then don't bother. */
 		if (!ctx->info->blobs && type == OBJ_BLOB)
-- 
2.48.1.519.gaa5dee9535
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 20 in “What's cooking in git.git (Jan 2025, #06; Wed, 22)”
  1. Junio C HamanoJan 22, 2025
  2. Jeff KingJan 23, 2025
  3. Junio C HamanoJan 23, 2025
  4. Jeff KingJan 31, 2025
  5. Jeff KingJan 31, 2025
  6. Junio C HamanoJan 31, 2025
  7. Jeff KingFeb 1, 2025
  8. Junio C HamanoFeb 2, 2025
  9. Junio C HamanoFeb 3, 2025
  10. Jeff KingFeb 4, 2025
  11. D. Ben KnobleFeb 2, 2025
  12. Junio C HamanoFeb 2, 2025
  13. Jeff KingFeb 3, 2025
  14. Eric SunshineJan 23, 2025
  15. Junio C HamanoJan 23, 2025
  16. Taylor BlauJan 23, 2025
  17. Patrick SteinhardtJan 24, 2025
  18. Toon ClaesJan 24, 2025
  19. Junio C HamanoJan 24, 2025
  20. Junio C HamanoJan 24, 2025

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.