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

[PATCH 08/13] report_path_error(): drop unused prefix parameter

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

This hasn't been used since 17ddc66e70 (convert report_path_error to take struct pathspec, 2013-07-14), as the names in the struct will have already been prefixed when they were parsed.

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin/checkout.c          | 2 +-
 builtin/commit.c            | 6 +++---
 builtin/ls-files.c          | 2 +-
 builtin/submodule--helper.c | 2 +-
 dir.c                       | 3 +--
 dir.h                       | 2 +-
 6 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 0e6037b296..72f7110fd8 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -376,7 +376,7 @@ static int checkout_paths(const struct checkout_opts *opts,
 							ps_matched,
 							opts);
 
-	if (report_path_error(ps_matched, &opts->pathspec, opts->prefix)) {
+	if (report_path_error(ps_matched, &opts->pathspec)) {
 		free(ps_matched);
 		return 1;
 	}
diff --git a/builtin/commit.c b/builtin/commit.c
index f17537474a..a138ff85b0 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -235,7 +235,7 @@ static int commit_index_files(void)
  * and return the paths that match the given pattern in list.
  */
 static int list_paths(struct string_list *list, const char *with_tree,
-		      const char *prefix, const struct pathspec *pattern)
+		      const struct pathspec *pattern)
 {
 	int i, ret;
 	char *m;
@@ -264,7 +264,7 @@ static int list_paths(struct string_list *list, const char *with_tree,
 			item->util = item; /* better a valid pointer than a fake one */
 	}
 
-	ret = report_path_error(m, pattern, prefix);
+	ret = report_path_error(m, pattern);
 	free(m);
 	return ret;
 }
@@ -454,7 +454,7 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix
 			die(_("cannot do a partial commit during a cherry-pick."));
 	}
 
-	if (list_paths(&partial, !current_head ? NULL : "HEAD", prefix, &pathspec))
+	if (list_paths(&partial, !current_head ? NULL : "HEAD", &pathspec))
 		exit(1);
 
 	discard_cache();
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index 29a8762d46..37a08c714b 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -680,7 +680,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
 
 	if (ps_matched) {
 		int bad;
-		bad = report_path_error(ps_matched, &pathspec, prefix);
+		bad = report_path_error(ps_matched, &pathspec);
 		if (bad)
 			fprintf(stderr, "Did you forget to 'git add'?\n");
 
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 6bcc4f1bd7..8342b78add 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -348,7 +348,7 @@ static int module_list_compute(int argc, const char **argv,
 			i++;
 	}
 
-	if (ps_matched && report_path_error(ps_matched, pathspec, prefix))
+	if (ps_matched && report_path_error(ps_matched, pathspec))
 		result = -1;
 
 	free(ps_matched);
diff --git a/dir.c b/dir.c
index b2cabadf25..5286f710cc 100644
--- a/dir.c
+++ b/dir.c
@@ -502,8 +502,7 @@ int submodule_path_match(const struct index_state *istate,
 }
 
 int report_path_error(const char *ps_matched,
-		      const struct pathspec *pathspec,
-		      const char *prefix)
+		      const struct pathspec *pathspec)
 {
 	/*
 	 * Make sure all pathspec matched; otherwise it is an error.
diff --git a/dir.h b/dir.h
index e3ec26143d..823bae628b 100644
--- a/dir.h
+++ b/dir.h
@@ -220,7 +220,7 @@ extern int match_pathspec(const struct index_state *istate,
 			  const struct pathspec *pathspec,
 			  const char *name, int namelen,
 			  int prefix, char *seen, int is_dir);
-extern int report_path_error(const char *ps_matched, const struct pathspec *pathspec, const char *prefix);
+extern int report_path_error(const char *ps_matched, const struct pathspec *pathspec);
 extern int within_depth(const char *name, int namelen, int depth, int max_depth);
 
 extern int fill_directory(struct dir_struct *dir,
-- 
2.21.0.701.g4401309e11
Previous: Jeff KingNext: Jeff King
Message 9 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.