git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Michael Haggerty <mhagger@alum.mit.edu>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
	git@vger.kernel.org, Stefan Beller <sbeller@google.com>,
	Christian Couder <chriscool@tuxfamily.org>
Subject: Re: [PATCH 3/4] replace-objects: evaluate replacement refs without using the object store
Date: Wed, 13 Sep 2017 07:15:01 -0400	[thread overview]
Message-ID: <20170913111501.cosukqzf76oy65ow@sigill.intra.peff.net> (raw)
In-Reply-To: <fe956802-41ab-783f-62b3-f7c4b8292e8c@alum.mit.edu>

On Wed, Sep 13, 2017 at 10:03:58AM +0200, Michael Haggerty wrote:

> On 09/12/2017 07:31 PM, Jonathan Nieder wrote:
> > From: Stefan Beller <sbeller@google.com>
> > 
> > Pass DO_FOR_EACH_INCLUDE_BROKEN when iterating over replacement refs
> > so that the iteration does not require opening the named objects from
> > the object store. This avoids a dependency cycle between object access
> > and replace ref iteration.
> > 
> > Moreover the ref subsystem has not been migrated yet to access the
> > object store via passed in repository objects.  As a result, without
> > this patch, iterating over replace refs in a repository other than
> > the_repository it produces errors:
> > 
> >    error: refs/replace/3afabef75c627b894cccc3bcae86837abc7c32fe does not point to a valid object!
> > 
> > Noticed while adapting the object store (and in particular its
> > evaluation of replace refs) to handle arbitrary repositories.
> 
> Have you checked that consumers of this API can handle broken
> references? Aside from missing values, broken references can have
> illegal names (though hopefully not unsafe in the sense of causing
> filesystem traversal outside of `$GITDIR`).

It looks like there are only two callers. One complains about
names that aren't 40-hex. The other ("git replace -l") parses the 40-hex
in "long" mode, but will print anything in short mode (not that printing
is very dangerous).

I do have to wonder if for_each_replace_ref() should just do the 40-hex
syntactic check itself (and issue a warning for other refs). It seems
like that would be the point of calling for_each_replace_ref() instead
of just for_each_ref_in("refs/replace") yourself, and both of the
callers would benefit.

-Peff

  reply	other threads:[~2017-09-13 11:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-12 17:23 [PATCH 0/4] Fixes from the per-repository object store series Jonathan Nieder
2017-09-12 17:28 ` [PATCH 1/4] pack: make packed_git_mru global a value instead of a pointer Jonathan Nieder
2017-09-12 17:30 ` [PATCH 2/4] push, fetch: error out for submodule entries not pointing to commits Jonathan Nieder
2017-09-14 12:45   ` Heiko Voigt
2017-09-18 16:52   ` Brandon Williams
2017-09-12 17:31 ` [PATCH 3/4] replace-objects: evaluate replacement refs without using the object store Jonathan Nieder
2017-09-13  8:03   ` Michael Haggerty
2017-09-13 11:15     ` Jeff King [this message]
2017-09-12 17:32 ` [PATCH 4/4] packed refs: pass .git dir instead of packed-refs path to init_fn Jonathan Nieder
2017-09-13  8:45   ` Michael Haggerty
2017-09-13 14:06     ` Richard Maw
2017-09-15  2:20 ` [PATCH 0/4] Fixes from the per-repository object store series 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=20170913111501.cosukqzf76oy65ow@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=mhagger@alum.mit.edu \
    --cc=sbeller@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).