git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Wincent Colaiuta" <win@wincent.com>,
	"Mislav Marohnić" <mislav.marohnic@gmail.com>
Subject: Re: [PATCH] add--interactive: do not expand pathspecs with ls-files
Date: Tue, 14 Mar 2017 18:09:37 -0400	[thread overview]
Message-ID: <20170314220937.xg6isonertnykx4y@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqd1djh5xl.fsf@gitster.mtv.corp.google.com>

On Tue, Mar 14, 2017 at 03:03:34PM -0700, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> > We can improve this by skipping "ls-files" completely, and
> > just feeding the original pathspecs to the diff commands.
> > This solution was discussed in 2010:
> >
> >   http://public-inbox.org/git/20100105041438.GB12574@coredump.intra.peff.net/
> >
> > but at the time the diff code's pathspecs were more
> > primitive than those used by ls-files (e.g., they did not
> > support globs). Making the change would have caused a
> > user-visible regression, so we didn't.
> 
> Heh.  The change and the reasoning are both obviously correct, but
> how did you find this?  Do you have a pile of "old patches that
> should be resurrected when time is right" and this was picked out of
> it, or did you see somebody else hit the same thing recently and
> then went back to the archive?

The latter.  Mislav reported it to me off-list earlier today, and I
generated the patch. But after scratching my head at the familiarity and
especially wondering if there was some reason to use "ls-files" here, I
dug up the linked thread. The fact that the patches are identical is
just coincidence (though it's such a simple change that it seems highly
likely).

> >      So this takes us one step closer to working correctly
> >      with files whose names contain wildcard characters, but
> >      it's likely that others remain (e.g., if "git add -i"
> >      feeds the selected paths to "git add").
> 
> We didn't run with --literal-pathspecs which was a bug, but I
> suspect that it didn't exist back then ;-).

Yep. I think judiciously inserting "--literal-pathspecs" is probably the
correct fix. In an earlier thread (that I linked elsewhere from the
discussion here) I suggested just setting $GIT_LITERAL_PATHSPECS to 1.
But that is probably a bad idea. As this patch shows, we do still
sometimes feed the original non-expanded pathspec to some commands.

I left that as potential low-hanging fruit for somebody who cares more
(the trickiest part is probably not the fix, but coming up with a test
case).

-Peff

      reply	other threads:[~2017-03-14 22:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-14 16:30 [PATCH] add--interactive: do not expand pathspecs with ls-files Jeff King
2017-03-14 16:31 ` Jeff King
2017-03-14 17:25 ` Brandon Williams
2017-03-14 17:31   ` Jeff King
2017-03-14 22:03 ` Junio C Hamano
2017-03-14 22:09   ` Jeff King [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170314220937.xg6isonertnykx4y@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mislav.marohnic@gmail.com \
    --cc=win@wincent.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).