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

Re: [PATCH] Produce a nicer output in case of sha1_object_info failures in ls-tree -l

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 19, 2009, 22:13 UTC
Message-ID
<7vmybh6u15.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20090319220020.GA8433@blimp.localdomain>
Alex Riesen <raa.lkml@gmail.com> writes:
Show 15 quoted lines
> Junio C Hamano, Thu, Mar 19, 2009 22:55:56 +0100:
>> Alex Riesen <raa.lkml@gmail.com> writes:
>> > @@ -91,6 +90,7 @@ static int show_tree(const unsigned char *sha1, const char *base, int baselen,
>> >  	if (!(ls_options & LS_NAME_ONLY)) {
>> >  		if (ls_options & LS_SHOW_SIZE) {
>> >  			if (!strcmp(type, blob_type)) {
>> > +				unsigned long size = 0;
>> >  				sha1_object_info(sha1, &size);
>> >  				printf("%06o %s %s %7lu\t", mode, type,
>> >  				       abbrev ? find_unique_abbrev(sha1, abbrev)
>> 
>> Hmm, shouldn't you be checking the return value from sha1_object_info()
>> and skipping the printf() altogether instead?
>
> But then I cannot know the name of the failed tree entry.
Why?
	if (sha1_object_info() == OBJ_BAD)
		die("object recorded at tree entry %s is bad", pathname);
	printf ...
Previous: Alex RiesenNext: Alex Riesen
Message 4 of 6 in “Produce a nicer output in case of sha1_object_info failures in ls-tree -l”
  1. Produce a nicer output in case of sha1_object_info failures in ls-tree -lAlex Riesen, Mar 19, 2009
  2. Junio C HamanoMar 19, 2009
  3. Alex RiesenMar 19, 2009
  4. Junio C HamanoMar 19, 2009
  5. Produce a nicer output in case of sha1_object_info failures in ls-tree -lAlex Riesen, Mar 19, 2009
  6. Junio C HamanoMar 19, 2009

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.