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

[PATCH 07/13] unpack-trees: drop unused error_type parameters

From
Jeff King <peff@peff.net>
Date
Mar 20, 2019, 08:15 UTC
Message-ID
<20190320081527.GG10403@sigill.intra.peff.net>
In-Reply-To
<20190320081258.GA5621@sigill.intra.peff.net>

The verify_clean_subdirectory() helper takes an error_type parameter from the caller, but doesn't actually use it. Instead, when it calls add_rejected_path() it passes NOT_UPTODATE_DIR, its own custom error type which is more specific than what the caller provides. Likewise for verify_clean_submodule(), which always passes WOULD_LOSE_SUBMODULE.

Signed-off-by: Jeff King <peff@peff.net>
---
 unpack-trees.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/unpack-trees.c b/unpack-trees.c
index 79551ab9cc..5f65ff5804 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1758,7 +1758,6 @@ static void invalidate_ce_path(const struct cache_entry *ce,
  */
 static int verify_clean_submodule(const char *old_sha1,
 				  const struct cache_entry *ce,
-				  enum unpack_trees_error_types error_type,
 				  struct unpack_trees_options *o)
 {
 	if (!submodule_from_ce(ce))
@@ -1769,7 +1768,6 @@ static int verify_clean_submodule(const char *old_sha1,
 }
 
 static int verify_clean_subdirectory(const struct cache_entry *ce,
-				     enum unpack_trees_error_types error_type,
 				     struct unpack_trees_options *o)
 {
 	/*
@@ -1792,7 +1790,7 @@ static int verify_clean_subdirectory(const struct cache_entry *ce,
 		if (!sub_head && oideq(&oid, &ce->oid))
 			return 0;
 		return verify_clean_submodule(sub_head ? NULL : oid_to_hex(&oid),
-					      ce, error_type, o);
+					      ce, o);
 	}
 
 	/*
@@ -1888,7 +1886,7 @@ static int check_ok_to_remove(const char *name, int len, int dtype,
 		 * files that are in "foo/" we would lose
 		 * them.
 		 */
-		if (verify_clean_subdirectory(ce, error_type, o) < 0)
+		if (verify_clean_subdirectory(ce, o) < 0)
 			return -1;
 		return 0;
 	}
-- 
2.21.0.701.g4401309e11
Previous: Jeff KingNext: Jeff King
Message 8 of 19 in “more unused parameter cleanups”
  1. 0/13 more unused parameter cleanupsJeff King, Mar 20, 2019
  2. 01/13 revision: drop some unused "revs" parametersJeff King, Mar 20, 2019
  3. 02/13 log: drop unused rev_info from early outputJeff King, Mar 20, 2019
  4. 03/13 log: drop unused "len" from show_tagger()Jeff King, Mar 20, 2019
  5. 04/13 update-index: drop unused prefix_length parameter from do_reupdate()Jeff King, Mar 20, 2019
  6. 05/13 test-date: drop unused "now" parameter from parse_dates()Jeff King, Mar 20, 2019
  7. 06/13 unpack-trees: drop name_entry from traverse_by_cache_tree()Jeff King, Mar 20, 2019
  8. 07/13 unpack-trees: drop unused error_type parametersJeff King, Mar 20, 2019
  9. 08/13 report_path_error(): drop unused prefix parameterJeff King, Mar 20, 2019
  10. 09/13 fetch_pack(): drop unused parametersJeff King, Mar 20, 2019
  11. 10/13 parse-options: drop unused ctx parameter from show_gitcomp()Jeff King, Mar 20, 2019
  12. 11/13 pretty: drop unused "type" parameter in needs_rfc2047_encoding()Jeff King, Mar 20, 2019
  13. 12/13 pretty: drop unused strbuf from parse_padding_placeholder()Jeff King, Mar 20, 2019
  14. 13/13 parse_opt_ref_sorting: always use with NONEG flagJeff King, Mar 20, 2019
  15. Martin ÅgrenMar 20, 2019
  16. Jeff KingMar 20, 2019
  17. Junio C HamanoMar 20, 2019
  18. Ævar Arnfjörð BjarmasonMar 21, 2019
  19. Jeff KingMar 21, 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.