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
Subject: Re: [PATCH] combine-diff: handle --find-object in multitree code path
Date: Wed, 30 Sep 2020 18:54:41 -0400	[thread overview]
Message-ID: <20200930225441.GD1908000@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqqmu16gbqk.fsf@gitster.c.googlers.com>

On Wed, Sep 30, 2020 at 03:07:15PM -0700, Junio C Hamano wrote:

> > +test_expect_success 'do not detect merge that does not touch blob' '
> > +	git checkout -B merge interesting &&
> > +	git merge -m "untouched blob" base &&
> > +	git diff-tree --format=%s --find-object=$blob -c --name-status HEAD >actual &&
> 
> You learn new things every day ;-)
> 
> I've always thought that for --find-object to do a good job, you'd
> need "--full-history" and perhaps "-m".  Especially, I didn't expect
> "-c" or "--cc" to make a difference.

You don't need --full-history, since there's no history simplification
going on here. And "-m" isn't very helpful with --find-object. It's
going to find every merge that crosses a boundary where the object was
introduced, since it will be introduced in the diff against the _other_
parent. E.g., in:

  A -- B
   \    \
    C -- M

If B introduces object X, then:

  git log --find-object=X -m M

is going to see the diff of C to M as introducing X. But M didn't do
anything interesting there; it just picked it up from the branch with B.

My concrete use case here, btw, is reporting to users which commit
introduced a blob (and at which path). It mostly works if you ignore
merges, but misses out on any evil merges which introduce the object.
Adding "-c" fixes that (but before this patch is slow and misses the
case where the merge removes the object).

-Peff

      reply	other threads:[~2020-09-30 22:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-30 11:52 [PATCH] combine-diff: handle --find-object in multitree code path Jeff King
2020-09-30 20:06 ` Chris Torek
2020-09-30 22:46   ` Jeff King
2020-09-30 22:07 ` Junio C Hamano
2020-09-30 22:54   ` 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=20200930225441.GD1908000@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).