git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: matvore@google.com, git@vger.kernel.org
Subject: Re: [PATCH] rev-list: allow cached objects in existence check
Date: Mon, 4 Mar 2019 16:17:49 -0500	[thread overview]
Message-ID: <20190304211749.GA3020@sigill.intra.peff.net> (raw)
In-Reply-To: <20190304191932.105204-1-jonathantanmy@google.com>

On Mon, Mar 04, 2019 at 11:19:32AM -0800, Jonathan Tan wrote:

> >   - some callers of has_sha1_file() might care about durability between
> >     processes. Because it's baked in, the empty tree is safe for that
> >     (whatever follow-on process runs, it will also be baked in there).
> >     But that's not necessarily true for other "cached" objects. I'm not
> >     really that worried about it because we use it sparingly (the only
> >     call to pretend_sha1_file() is in git-blame, and if it ever did ask
> >     "do we have this object", I actually think the right answer would be
> >     "yes").
> > 
> >     But if this is a concern, we could perhaps have two levels of flags:
> >     SKIP_CACHED and SKIP_INTERNAL.
> 
> Or teach git-blame to have its own pretend mechanism, and remove the
> pretend mechanism from sha1-file.c.

I think that would be ideal, but I'm not sure if it's feasible due to
the layering of the various modules. IOW, the blame code isn't just
pretending a fake object file for _itself_, it needs to then call into
the diff code, which must be able to then find that content in order to
produce a diff.

But maybe it is not so bad. Our diff_filespec struct does represent
working-tree files (as it must, since we diff them!). So it may be
possible to feed it to the diff code at the right spot.

I haven't looked closely enough to say for sure whether it's feasible or
not. But it does imply to me that we should go with this regression fix
in the near-term and think about building bigger changes separately on
master.

> The last time I deeply thought of this was during the partial clone
> implementation, so I am probably not completely up-to-date, but it seems
> to me that ideally, for reading, we would remove SKIP_CACHED completely
> (and always consult the cache), and also remove completely the ability
> to pretend (blame will have to do it by itself); and for writing, we
> would write the empty tree whenever we do now (for backwards
> compatibility with old versions of Git that read what we write). Both
> the approach in this patch and making has_object_file() respect cached
> objects are steps in that direction, so I'm OK with both.

Yeah, I think our world-views are in accord. :)

-Peff

  reply	other threads:[~2019-03-04 21:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-04 17:40 [PATCH] rev-list: allow cached objects in existence check Jeff King
2019-03-04 19:19 ` Jonathan Tan
2019-03-04 21:17   ` Jeff King [this message]
2019-03-05 13:33     ` Junio C Hamano
2019-03-05 19:27       ` Jeff King
2019-03-05 13:28 ` 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

  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=20190304211749.GA3020@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=jonathantanmy@google.com \
    --cc=matvore@google.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).