git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] ref-filter: don't look for objects when outside of a repository

From
Jeff King <peff@peff.net>
Date
Sep 24, 2018, 21:30 UTC
Message-ID
<20180924213000.GA7047@sigill.intra.peff.net>
In-Reply-To
<20180924212034.GF27036@localhost>
On Mon, Sep 24, 2018 at 11:20:34PM +0200, SZEDER Gábor wrote:
Show 17 quoted lines
> > 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.

Ah, I didn't realize we actually documented that. And perhaps it is more consistent, too: you'd get different results from running "ls-remote" outside a repository versus one that just doesn't have the objects from the other side.

Show 5 quoted lines
> 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.

Yeah, that probably would be a better place. Though your response also has made me think that maybe just sticking with the "missing object" response is reasonable. I don't have a strong opinion between the two.

-Peff
Previous: SZEDER GáborNext: Junio C Hamano
Message 7 of 15 in “Coredump on ls-remote + --sort”
  1. H.Merijn BrandSep 22, 2018
  2. Ævar Arnfjörð BjarmasonSep 22, 2018
  3. ref-filter: don't look for objects when outside of a repositorySZEDER Gábor, Sep 22, 2018
  4. Junio C HamanoSep 24, 2018
  5. Jeff KingSep 24, 2018
  6. SZEDER GáborSep 24, 2018
  7. Jeff KingSep 24, 2018
  8. Junio C HamanoSep 25, 2018
  9. ref-filter: don't look for objects when outside of a repositorySZEDER Gábor, Nov 14, 2018
  10. Jeff KingNov 15, 2018
  11. Jeff KingNov 15, 2018
  12. Junio C HamanoNov 16, 2018
  13. Jeff KingNov 16, 2018
  14. Junio C HamanoNov 16, 2018
  15. SZEDER GáborNov 16, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.