From: Junio C Hamano <gitster@pobox.com>
To: Dietrich Epp <depp@moria.us>
Cc: git@vger.kernel.org
Subject: Re: git rm --pathspec-from-file does not work in subdirectories
Date: Fri, 28 May 2021 13:59:48 +0900 [thread overview]
Message-ID: <xmqqlf7z78sb.fsf@gitster.g> (raw)
In-Reply-To: <CAKGua8U25GF=mC+vRARRY99ZgaHoUOA7vppmOUdWoeB=bf3NAA@mail.gmail.com> (Dietrich Epp's message of "Fri, 28 May 2021 00:20:47 -0400")
Dietrich Epp <depp@moria.us> 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.
next prev parent reply other threads:[~2021-05-28 4:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-28 4:20 git rm --pathspec-from-file does not work in subdirectories Dietrich Epp
2021-05-28 4:59 ` Junio C Hamano [this message]
2021-05-28 5:08 ` Eric Sunshine
2021-05-28 5:56 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqlf7z78sb.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=depp@moria.us \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).