All of lore.kernel.org
 help / color / mirror / Atom feed
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 10:31:04 +0200	[thread overview]
Message-ID: <akdzSHrJ4DfdUWoS@pks.im> (raw)
In-Reply-To: <323134122.20260702104910@gmail.com>

Hi,

On Thu, Jul 02, 2026 at 10:49:10AM +0300, Евгений Плискин wrote:
> Hello.
> 
> The following git command does recurse directories as contrary to the
> reference (https://git-scm.com/docs/git-rm):
> 
>     git rm -n *.json
> 
> Without directory specification before '*.json' this command is not
> expected to recurse directories, but it really does.

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?

Thanks!

Patrick

  parent reply	other threads:[~2026-07-03  8:31 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 [this message]
2026-07-03 10:04   ` Phillip Wood
     [not found]   ` <1756071445.20260703123414@gmail.com>
2026-07-03 12:39     ` Patrick Steinhardt
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=akdzSHrJ4DfdUWoS@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.