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

[PATCH 1/8] match-trees: drop unused path parameter from score functions

From
Jeff King <peff@peff.net>
Date
Jan 24, 2019, 13:11 UTC
Message-ID
<20190124131133.GA22398@sigill.intra.peff.net>
In-Reply-To
<20190124131104.GA24017@sigill.intra.peff.net>

The scores do not take the particular path into account at all. It's possible they could, but these are all static file-local functions. It won't be a big deal to re-add the parameter if they ever need it.

Signed-off-by: Jeff King <peff@peff.net>
---
 match-trees.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/match-trees.c b/match-trees.c
index 2b6d31ef9d..e65e665bf5 100644
--- a/match-trees.c
+++ b/match-trees.c
@@ -3,7 +3,7 @@
 #include "tree-walk.h"
 #include "object-store.h"
 
-static int score_missing(unsigned mode, const char *path)
+static int score_missing(unsigned mode)
 {
 	int score;
 
@@ -16,7 +16,7 @@ static int score_missing(unsigned mode, const char *path)
 	return score;
 }
 
-static int score_differs(unsigned mode1, unsigned mode2, const char *path)
+static int score_differs(unsigned mode1, unsigned mode2)
 {
 	int score;
 
@@ -29,7 +29,7 @@ static int score_differs(unsigned mode1, unsigned mode2, const char *path)
 	return score;
 }
 
-static int score_matches(unsigned mode1, unsigned mode2, const char *path)
+static int score_matches(unsigned mode1, unsigned mode2)
 {
 	int score;
 
@@ -98,24 +98,22 @@ static int score_trees(const struct object_id *hash1, const struct object_id *ha
 
 		if (cmp < 0) {
 			/* path1 does not appear in two */
-			score += score_missing(one.entry.mode, one.entry.path);
+			score += score_missing(one.entry.mode);
 			update_tree_entry(&one);
 		} else if (cmp > 0) {
 			/* path2 does not appear in one */
-			score += score_missing(two.entry.mode, two.entry.path);
+			score += score_missing(two.entry.mode);
 			update_tree_entry(&two);
 		} else {
 			/* path appears in both */
 			if (!oideq(one.entry.oid, two.entry.oid)) {
 				/* they are different */
 				score += score_differs(one.entry.mode,
-						       two.entry.mode,
-						       one.entry.path);
+						       two.entry.mode);
 			} else {
 				/* same subtree or blob */
 				score += score_matches(one.entry.mode,
-						       two.entry.mode,
-						       one.entry.path);
+						       two.entry.mode);
 			}
 			update_tree_entry(&one);
 			update_tree_entry(&two);
-- 
2.20.1.842.g8986705066
Previous: Jeff KingNext: Jeff King
Message 2 of 13 in “drop some unused parameters”
  1. 0/9 drop some unused parametersJeff King, Jan 24, 2019
  2. 1/8 match-trees: drop unused path parameter from score functionsJeff King, Jan 24, 2019
  3. 2/8 apply: drop unused "def" parameter from find_name_gnu()Jeff King, Jan 24, 2019
  4. 3/8 create_bundle(): drop unused "header" parameterJeff King, Jan 24, 2019
  5. 4/8 column: drop unused "opts" parameter in item_length()Jeff King, Jan 24, 2019
  6. 5/8 show_date_relative(): drop unused "tz" parameterJeff King, Jan 24, 2019
  7. Derrick StoleeJan 24, 2019
  8. 6/8 config: drop unused parameter from maybe_remove_section()Jeff King, Jan 24, 2019
  9. 7/8 convert: drop len parameter from conversion checksJeff King, Jan 24, 2019
  10. 8/8 convert: drop path parameter from actual conversion functionsJeff King, Jan 24, 2019
  11. Derrick StoleeJan 24, 2019
  12. Junio C HamanoJan 24, 2019
  13. brian m. carlsonJan 25, 2019

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.