From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, "H . Merijn Brand" <h.m.brand@xs4all.nl>,
"Harald Nordgren" <haraldnordgren@gmail.com>,
"Olga Telezhnaia" <olyatelezhnaya@gmail.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Junio C Hamano" <gitster@pobox.com>
Subject: Re: [PATCH] ref-filter: don't look for objects when outside of a repository
Date: Mon, 24 Sep 2018 23:20:34 +0200 [thread overview]
Message-ID: <20180924212034.GF27036@localhost> (raw)
In-Reply-To: <20180924181722.GA25341@sigill.intra.peff.net>
On Mon, Sep 24, 2018 at 02:17:22PM -0400, Jeff King wrote:
> On Sat, Sep 22, 2018 at 04:11:45PM +0200, SZEDER Gábor wrote:
> > diff --git a/ref-filter.c b/ref-filter.c
> > index e1bcb4ca8a..3555bc29e7 100644
> > --- a/ref-filter.c
> > +++ b/ref-filter.c
> > @@ -1473,7 +1473,8 @@ static int get_object(struct ref_array_item *ref, int deref, struct object **obj
> > oi->info.sizep = &oi->size;
> > oi->info.typep = &oi->type;
> > }
> > - if (oid_object_info_extended(the_repository, &oi->oid, &oi->info,
> > + if (!have_git_dir() ||
> > + oid_object_info_extended(the_repository, &oi->oid, &oi->info,
> > OBJECT_INFO_LOOKUP_REPLACE))
> > return strbuf_addf_ret(err, -1, _("missing object %s for %s"),
> > oid_to_hex(&oi->oid), ref->refname);
>
> Would we perhaps want to give the user a hint that the object is not
> really missing, but rather that we're not in a repository? E.g.,
> something like:
>
> if (!have_git_dir())
> return strbuf_addf_ret(err, -1, "format specifier requires a repository");
> if (oid_object_info_extended(...))
> return ...;
>
> ?
I think it makes sense.
I wanted to preserve the error message, because the description of
'--sort=<key>' in 'Documentation/git-ls-remote.txt' explicitly
mentions it, and I added the condition at this place because I didn't
want to duplicate the construction of the error message.
However, if we go for a more informative error message, then wouldn't
it be better to add this condition in populate_value() before it even
calls get_object()? Then we could also add the problematic format
specifier to the error message (I think, but didn't actually check),
just in case someone specified multiple sort keys.
next prev parent reply other threads:[~2018-09-24 21:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-22 10:42 Coredump on ls-remote + --sort H.Merijn Brand
2018-09-22 12:33 ` Ævar Arnfjörð Bjarmason
2018-09-22 14:11 ` [PATCH] ref-filter: don't look for objects when outside of a repository SZEDER Gábor
2018-09-24 16:15 ` Junio C Hamano
2018-09-24 18:17 ` Jeff King
2018-09-24 21:20 ` SZEDER Gábor [this message]
2018-09-24 21:30 ` Jeff King
2018-09-25 20:57 ` Junio C Hamano
2018-11-14 12:27 ` SZEDER Gábor
2018-11-15 9:38 ` Jeff King
2018-11-15 9:43 ` Jeff King
2018-11-16 5:09 ` Junio C Hamano
2018-11-16 8:56 ` Jeff King
2018-11-16 10:07 ` Junio C Hamano
2018-11-16 13:16 ` SZEDER Gábor
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=20180924212034.GF27036@localhost \
--to=szeder.dev@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=h.m.brand@xs4all.nl \
--cc=haraldnordgren@gmail.com \
--cc=olyatelezhnaya@gmail.com \
--cc=peff@peff.net \
/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).