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

Re: [PATCH] revision.c: drop missing objects from cmdline

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 24, 2018, 04:54 UTC
Message-ID
<xmqqa7n4osgi.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20181023215745.245333-1-matvore@google.com>
Matthew DeVore <matvore@google.com> writes:
> No code which reads cmdline in struct rev_info can handle NULL objects
> in cmdline.rev[i].item, so stop adding them to the cmdline.rev array.

"The code is not prepared to have cmdline.rev[].item that is NULL" is something everybody would understand and agree with, but that does not automatically lead to "so ignoring or rejecting and dying is OK", though. The cmdline thing is used for the commands to learn the end-user intent that cannot be learned by the resulting objects in the object array (e.g. the user may have said 'master' but the pending[] (and later revs.commits) would only have the object names, and some callers would want to know if it was a branch name, a refname refs/heads/master, or the hexadecimal object name), so unless absolutely needed, I'm hesitant to take a change that loses information (e.g. the user named this object that is not locally available, we cannot afford to add it to the pending[] and add it to revs.commits to traverse from there, but we still want to know what object was given by the user).

> Objects in cmdline are NULL when the given object is promisor and
> --exclude-promisor-objects is enabled.

A "promisor" is a remote repository. It promises certain objects that you do not have are later retrievable from it. The way you can see if the promisor promised to later give you an object is to see if that missing object is reachable from an object in a packfile the promisor gave you earlier.

"The given object" is never a "promisor", so I am not sure what the above wants to say. Is

    When an object is given on the command line and if it is missing
    from the local repository, add_rev_cmdline() receives NULL in
    its "item" parameter.

what you meant? Is that the _only_ case in which "item" could be NULL, or is it also true for any missing object due to repository corruption?

Previous: Matthew DeVoreNext: Matthew DeVore
Message 2 of 7 in “revision.c: drop missing objects from cmdline”
  1. revision.c: drop missing objects from cmdlineMatthew DeVore, Oct 23, 2018
  2. Junio C HamanoOct 24, 2018
  3. Matthew DeVoreOct 25, 2018
  4. list-objects.c: don't segfault for missing cmdline objectsMatthew DeVore, Oct 25, 2018
  5. Junio C HamanoOct 29, 2018
  6. list-objects.c: don't segfault for missing cmdline objectsMatthew DeVore, Dec 5, 2018
  7. Junio C HamanoDec 6, 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.