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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 22, 2025 at 02:48:43PM -0800, Junio C Hamano wrote:

> * 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@xxxxxx>
>  source: <pull.1818.v4.git.1734711675.gitgitgadget@xxxxxxxxx>

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@xxxxxxxx>
---
 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





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux