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

[PATCH v2 4/6] verify_one_sparse(): drop unused repository parameter

From
Jeff King <peff@peff.net>
Date
Aug 20, 2022, 09:02 UTC
Message-ID
<YwCjOETsh1o8u0Og@coredump.intra.peff.net>
In-Reply-To
<9829e1cf-21aa-0c10-0b64-c8a2ffdbc943@web.de>
On Sat, Aug 20, 2022 at 10:48:47AM +0200, René Scharfe wrote:
Show 16 quoted lines
> > diff --git a/cache-tree.c b/cache-tree.c
> > index 56db0b5026..c97111cccf 100644
> > --- a/cache-tree.c
> > +++ b/cache-tree.c
> > @@ -857,9 +857,7 @@ int cache_tree_matches_traversal(struct cache_tree *root,
> >  	return 0;
> >  }
> >
> > -static void verify_one_sparse(struct repository *r,
> > -			      struct index_state *istate,
> > -			      struct cache_tree *it,
> > +static void verify_one_sparse(struct index_state *istate,
> 
> This also removes the cache_tree parameter, which has never been used as
> well, but is not mentioned in the commit message.  A good change, to be
> sure.

Good catch. I wrote the patch itself over a year ago (whenever the commit made it into 'next' and failed my compilation), but I didn't write the commit message until recently. And when re-reading the patch I totally missed that _two_ parameters went away.

Given that and Stolee's earlier comment, here's a proposed commit message that explains it better:

-- >8 --
Subject: verify_one_sparse(): drop unused parameters

This function has never used its repository or cache_tree parameters since it was introduced in 9ad2d5ea71 (sparse-index: loose integration with cache_tree_verify(), 2021-03-30).

As that commit notes, it may eventually be extended further, and that might require looking at more data. But we can easily add them back if necessary (and the repository is even included in the index_state these days already). In the mean time, dropping them makes the code shorter and appeases -Wunused-parameter.

Signed-off-by: Jeff King <peff@peff.net>
---
 cache-tree.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/cache-tree.c b/cache-tree.c
index 56db0b5026..c97111cccf 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -857,9 +857,7 @@ int cache_tree_matches_traversal(struct cache_tree *root,
 	return 0;
 }
 
-static void verify_one_sparse(struct repository *r,
-			      struct index_state *istate,
-			      struct cache_tree *it,
+static void verify_one_sparse(struct index_state *istate,
 			      struct strbuf *path,
 			      int pos)
 {
@@ -910,7 +908,7 @@ static int verify_one(struct repository *r,
 			return 1;
 
 		if (pos >= 0) {
-			verify_one_sparse(r, istate, it, path, pos);
+			verify_one_sparse(istate, path, pos);
 			return 0;
 		}
 
-- 
2.37.2.964.g6266ca593d
Previous: René ScharfeNext: Jeff King
Message 15 of 21 in “unused function parameter potpourri”
  1. 0/6 unused function parameter potpourriJeff King, Aug 19, 2022
  2. 1/6 xdiff: drop unused mmfile parameters from xdl_do_histogram_diff()Jeff King, Aug 19, 2022
  3. Phillip WoodAug 19, 2022
  4. Jeff KingAug 20, 2022
  5. 7/6 xdiff: drop unused mmfile parameters from xdl_do_patience_diff()Jeff King, Aug 20, 2022
  6. Phillip WoodAug 26, 2022
  7. 2/6 log-tree: drop unused commit param in remerge_diff()Jeff King, Aug 19, 2022
  8. Elijah NewrenAug 19, 2022
  9. Jeff KingAug 20, 2022
  10. 3/6 match_pathname(): drop unused "flags" parameterJeff King, Aug 19, 2022
  11. 4/6 verify_one_sparse(): drop unused repository parameterJeff King, Aug 19, 2022
  12. Derrick StoleeAug 19, 2022
  13. Jeff KingAug 20, 2022
  14. René ScharfeAug 20, 2022
  15. 4/6 verify_one_sparse(): drop unused repository parameterJeff King, Aug 20, 2022
  16. 5/6 reftable: drop unused parameter from reader_seek_linear()Jeff King, Aug 19, 2022
  17. Derrick StoleeAug 19, 2022
  18. Han-Wen NienhuysAug 22, 2022
  19. 6/6 reflog: assert PARSE_OPT_NONEG in parse-options callbacksJeff King, Aug 19, 2022
  20. Derrick StoleeAug 19, 2022
  21. Elijah NewrenAug 19, 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.