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

Re: [PATCH v3 2/3] sha1_file: implement changes for "cat-file --literally -t"

From
karthik nayak <karthik.188@gmail.com>
Date
Mar 8, 2015, 10:49 UTC
Message-ID
<54FC292C.5060405@gmail.com>
In-Reply-To
<xmqqegozsvx5.fsf@gitster.dls.corp.google.com>
On 03/08/2015 02:33 PM, Junio C Hamano wrote:
Show 18 quoted lines
> karthik nayak <karthik.188@gmail.com> writes:
>
> > What parse_sha1_header() does to get the type is just find the first
> > occurrence of a " " manually and store everything before it as the
> > type. Then it finds the size of the object if needed. And finally
> > returns the type by calling type_from_string(). This is where we get
> > the undefined type error.
>
> Yes, exactly.  The change illustrated in $gmane/264420 may be
> incomplete and some calls from the sha1_object_info_extended() after
> that change may still need to further be tweaked to pay attention to
> LOOKUP_LITERALLY bit; for example, parse_sha1_header() may want to
> learn not to barf when seeing an unexpected typename in the header
> when the caller asks to look up "literally".
>
> I thought I already said that; sorry if I forgot.
>
>

Sorry for the confusion, you did already say that in $gmane/264955 , I'm talking about how I tackled the issue in $gmane/264855.

Like :
     else if ((flags & LOOKUP_LITERALLY)) {
         size_t typelen = strcspn(hdrbuf.buf, " ");
         strbuf_add(oi->typename, hdrbuf.buf, typelen);
     }
     else if ((status = parse_sha1_header(hdrp, &size)) < 0)
         status = error("unable to parse %s header", sha1_to_hex(sha1));
     else if (oi->sizep)
         *oi->sizep = size;

This way, we don't have to modify parse_sha1_header() to worry if "literally" is set or not.

Previous: Junio C HamanoNext: Junio C Hamano
Message 13 of 18 in “cat-file: add "--literally" option”
  1. 0/3 cat-file: add "--literally" optionkarthik nayak, Mar 5, 2015
  2. 1/3 cache: modify for "cat-file --literally -t"Karthik Nayak, Mar 5, 2015
  3. Eric SunshineMar 8, 2015
  4. karthik nayakMar 9, 2015
  5. 2/3 sha1_file: implement changes for "cat-file --literally -t"Karthik Nayak, Mar 5, 2015
  6. Junio C HamanoMar 5, 2015
  7. karthik nayakMar 6, 2015
  8. Junio C HamanoMar 6, 2015
  9. karthik nayakMar 7, 2015
  10. Junio C HamanoMar 8, 2015
  11. karthik nayakMar 8, 2015
  12. Junio C HamanoMar 8, 2015
  13. karthik nayakMar 8, 2015
  14. Junio C HamanoMar 8, 2015
  15. karthik nayakMar 9, 2015
  16. 3/3 cat-file: add "--literally" optionKarthik Nayak, Mar 5, 2015
  17. Eric SunshineMar 8, 2015
  18. karthik nayakMar 9, 2015

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.