From: Patrick Steinhardt <ps@pks.im>
To: "Евгений Плискин" <eugene.pliskin@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Unexpected recursion in 'git rm'
Date: Fri, 3 Jul 2026 14:39:47 +0200 [thread overview]
Message-ID: <aketk4ensXGZS4eI@pks.im> (raw)
In-Reply-To: <1756071445.20260703123414@gmail.com>
Adding the mailing list back into Cc.
On Fri, Jul 03, 2026 at 12:34:14PM +0300, Евгений Плискин wrote:
> > This is expected behaviour, as the argument to git-rm(1) is a pathspec, and "*" matches directory separators by default, see also gitglossary(7) under "pathspec":
> > • the pathspec up to the last slash represents a directory prefix. The scope of that pathspec is limited to that subtree.
> > • the rest of the pathspec is a pattern for the remainder of the pathname. Paths relative to the directory prefix will be matched against that pattern using fnmatch(3); in particular, * and ? can match directory separators.
> > For example, Documentation/*.jpg will match all .jpg files in the Documentation subtree, including Documentation/chapter_1/figure_1.jpg.
> > Could you maybe clarify which part of git-rm(1) made you think that this wouldn't happen?
>
> Thank you for your reply. I believe you are correct.
>
> I have made more research and found a way to remove files in current directory only without recursion into subdirectories:
> git rm -n ':(glob)*.json'
Yup, that wouldn't cross directory separators indeed.
Patrick
next prev parent reply other threads:[~2026-07-03 12:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-02 7:49 Unexpected recursion in 'git rm' Евгений Плискин
2026-07-03 7:01 ` Matt Hunter
[not found] ` <1978773121.20260703123754@gmail.com>
2026-07-03 13:04 ` Matt Hunter
2026-07-03 8:31 ` Patrick Steinhardt
2026-07-03 10:04 ` Phillip Wood
[not found] ` <1756071445.20260703123414@gmail.com>
2026-07-03 12:39 ` Patrick Steinhardt [this message]
2026-07-03 15:25 ` Mikael Magnusson
2026-07-03 20:41 ` 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=aketk4ensXGZS4eI@pks.im \
--to=ps@pks.im \
--cc=eugene.pliskin@gmail.com \
--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