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

2 messages, 2 authors, 2021-05-28 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2021-05-28 04:59:55

Dietrich Epp [off-list ref] writes:
How to reproduce: cd into a subdirectory and use git rm
--pathspec-from-file. For example, in Git's repo, at the top level:

$ git rm --pathspec-from-file=/dev/null
fatal: No pathspec was given. Which files should I remove?
$ cd compat
$ git rm --pathspec-from-file=/dev/null
fatal: --pathspec-from-file is incompatible with pathspec arguments
Thanks for a report.

I think this reveals issues with not just the --pathspec-from-file
which has been added relatively recently, but potentially a larger
issue "git rm" from subdirectory has.

When run from a subdirectory, "git rm" without pathspec behaves
as if a single "." (i.e. everything underneath the current
directory) is given as the pathspec.  Of course, this is incompatible
with reading of the pathspec elements from a file and unfortunately
it cannot be disabled, so there currently is no way to use the option
if you are in a subdirectory.

But a potentially larger problem is that "git rm -r" will remove
everything under the current directory unless you are at the top
level of the working tree, even when the user does not give "." to
explicitly say "I want everything under the current directory gone".

I wonder if the attached patch would make both issues better.

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

From: Eric Sunshine <hidden>
Date: 2021-05-28 05:08:57

On Fri, May 28, 2021 at 1:07 AM Junio C Hamano [off-list ref] wrote:
I wonder if the attached patch would make both issues better.
The "attached patch" is missing.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help