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

Re: git rm --pathspec-from-file does not work in subdirectories

From
Junio C Hamano <gitster@pobox.com>
Date
May 28, 2021, 05:56 UTC
Message-ID
<xmqqh7in7650.fsf@gitster.g>
In-Reply-To
<CAPig+cT6ztfUYjbsfFmYZ=UOcyk=9rFKqEuE=EE4y2rdBftGag@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
> On Fri, May 28, 2021 at 1:07 AM Junio C Hamano <gitster@pobox.com> wrote:
>> I wonder if the attached patch would make both issues better.
>
> The "attached patch" is missing.

Heh. Something along this line, but I think pathspec-from-file still needs a bit more work even with this patch.

 builtin/rm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git c/builtin/rm.c w/builtin/rm.c
index 8a24c715e0..a4a8a1ad8d 100644
--- c/builtin/rm.c
+++ w/builtin/rm.c
@@ -265,7 +265,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 			     builtin_rm_usage, 0);
 
 	parse_pathspec(&pathspec, 0,
-		       PATHSPEC_PREFER_CWD,
+		       PATHSPEC_PREFER_FULL,
 		       prefix, argv);
 
 	if (pathspec_from_file) {
@@ -273,7 +273,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 			die(_("--pathspec-from-file is incompatible with pathspec arguments"));
 
 		parse_pathspec_file(&pathspec, 0,
-				    PATHSPEC_PREFER_CWD,
+				    PATHSPEC_PREFER_FULL,
 				    prefix, pathspec_from_file, pathspec_file_nul);
 	} else if (pathspec_file_nul) {
 		die(_("--pathspec-file-nul requires --pathspec-from-file"));
Previous: Eric Sunshine
Message 4 of 4 in “git rm --pathspec-from-file does not work in subdirectories”
  1. Dietrich EppMay 28, 2021
  2. Junio C HamanoMay 28, 2021
  3. Eric SunshineMay 28, 2021
  4. Junio C HamanoMay 28, 2021

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.