git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: karthik nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v3 2/3] sha1_file: implement changes for "cat-file --literally -t"
Date: Sun, 08 Mar 2015 00:09:54 -0800	[thread overview]
Message-ID: <xmqqpp8jsyel.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <54FACD30.6080005@gmail.com> (karthik nayak's message of "Sat, 07 Mar 2015 15:34:32 +0530")

karthik nayak <karthik.188@gmail.com> writes:

> On 03/07/2015 12:58 AM, Junio C Hamano wrote:
>
> case 't':
> 	oi.typep = &type;
> 	oi.typename = &sb;
> 	sha1_object_info_extended(sha1, &oi, flags);
> 	if (sb.len) {
> 		printf("%s\n", sb.buf);
> 		strbuf_release(&sb);
> 		return 0;
> 	} else if (type) {
> 		printf("%s\n", typename(type));
> 		return 0;
> 	}
> 	break;
>
> This works but I need an else statement to check the type if not
> getting the type literally, which is because if not called literally
> the oi.typename is not set,...

Hmph, when I outlined that change to object-info-extended, I meant
to do it in such a way that when the optional oi->typename is set,
it is always filled whether "literally" is asked for andr whether
the object is a kosher one or a bogus one.

Without parsing the header, we wouldn't know how long the object
would be, so I do not know if not doing some variant of parse_header
is an option.

Thanks.

  reply	other threads:[~2015-03-08  8:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-05 18:16 [PATCH v3 0/3] cat-file: add "--literally" option karthik nayak
2015-03-05 18:18 ` [PATCH v3 1/3] cache: modify for "cat-file --literally -t" Karthik Nayak
2015-03-08 22:25   ` Eric Sunshine
2015-03-09 12:56     ` karthik nayak
2015-03-05 18:19 ` [PATCH v3 2/3] sha1_file: implement changes " Karthik Nayak
2015-03-05 23:45   ` Junio C Hamano
2015-03-06 17:41     ` karthik nayak
2015-03-06 19:28       ` Junio C Hamano
2015-03-07 10:04         ` karthik nayak
2015-03-08  8:09           ` Junio C Hamano [this message]
2015-03-08  8:48             ` karthik nayak
2015-03-08  9:03               ` Junio C Hamano
2015-03-08 10:49                 ` karthik nayak
2015-03-08 19:09                   ` Junio C Hamano
2015-03-09 13:08                     ` karthik nayak
2015-03-05 18:19 ` [PATCH v3 3/3] cat-file: add "--literally" option Karthik Nayak
2015-03-08 22:50   ` Eric Sunshine
2015-03-09 12:53     ` karthik nayak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqpp8jsyel.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).