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

Re: [PATCH] revision: allow missing promisor objects on CLI

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 28, 2019, 03:50 UTC
Message-ID
<xmqqlfqxhzvu.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20191228003430.241283-1-jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
Show 7 quoted lines
>  	object = get_reference(revs, arg, &oid, flags ^ local_flags);
>  	if (!object)
> -		return revs->ignore_missing ? 0 : -1;
> +		/*
> +		 * Either this object is missing and ignore_missing is true, or
> +		 * this object is a (missing) promisor object and
> +		 * exclude_promisor_objects is true.

I had to guess and dig where these assertions are coming from; we should not force future readers of the code to.

At least this comment must say why these assertions hold. Say something like "get_reference() yields NULL on only such and such cases" before concluding with "and in any of these cases, we can safely ignore it because ...".

I think the two cases the comment covers are safe for this caller to silently return 0. Another case get_reference() yields NULL is when oid_object_info() says it is a commit but it turns out that the object is found by repo_parse_commit() to be a non-commit, isn't it? I am not sure if it is safe for this caller to just return 0. There may be some other "unusual-but-not-fatal" cases where get_reference() does not hit a die() but returns NULL.

Thanks.
Previous: Jonathan TanNext: Jonathan Tan
Message 2 of 12 in “revision: allow missing promisor objects on CLI”
  1. revision: allow missing promisor objects on CLIJonathan Tan, Dec 28, 2019
  2. Junio C HamanoDec 28, 2019
  3. Jonathan TanDec 30, 2019
  4. Junio C HamanoDec 30, 2019
  5. revision: allow missing promisor objects on CLIJonathan Tan, Dec 30, 2019
  6. Jonathan NiederDec 31, 2019
  7. Jonathan TanJan 2, 2020
  8. 0/2 Un-regress rev-list --exclude-promisor-objectsJonathan Tan, Jan 11, 2020
  9. 1/2 revision: document get_reference()Jonathan Tan, Jan 11, 2020
  10. Emily ShafferMar 25, 2020
  11. 2/2 revision: un-regress --exclude-promisor-objectsJonathan Tan, Jan 11, 2020
  12. Emily ShafferMar 25, 2020

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.