git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: "Clément Poulain" <clement.poulain@ensimag.imag.fr>
Cc: git@vger.kernel.org,
	Diane Gasselin <diane.gasselin@ensimag.imag.fr>,
	Axel Bonnet <axel.bonnet@ensimag.imag.fr>
Subject: Re: [PATCH v2 2/4] textconv: support for cat_file
Date: Tue, 08 Jun 2010 20:12:18 +0200	[thread overview]
Message-ID: <vpq7hm95r7h.fsf@bauges.imag.fr> (raw)
In-Reply-To: <1276004958-13540-3-git-send-email-clement.poulain@ensimag.imag.fr> ("Clément Poulain"'s message of "Tue\,  8 Jun 2010 15\:49\:16 +0200")

Clément Poulain <clement.poulain@ensimag.imag.fr> writes:

> --- a/builtin/cat-file.c
> +++ b/builtin/cat-file.c
> @@ -9,6 +9,7 @@
> +	struct object_context obj_context = OBJECT_CONTEXT_INIT;
>  
> -	if (get_sha1(obj_name, sha1))
> +	if (get_sha1_with_context(obj_name, sha1, &obj_context))

Do you really need to initialize obj_context here? I'd say the
semantics of get_sha1_with_context should be "give me a pointer to an
object_context, and I'll fill it in with the object context, whatever
be its initial value", just like

int i;
scanf("%d", &i);

doesn't require i to be initialized.

> +	case 'c':
> +		if (!obj_context.path)
> +			die("git cat-file --textconv %s: <object> must be <sha1:path>",
> +			    obj_name);

obj_context.path is an array contained in the struct. It is always
non-null. Just tried:

$ ./git cat-file --textconv 99f036302a7e6d884369d1d3f4ce428e437cbccd | head
fatal: git cat-file --textconv: unable to run textconv on 99f036302a7e6d884369d1d3f4ce428e437cbccd

you want to check that obj_context.path contains an empty string.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

  parent reply	other threads:[~2010-06-08 18:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-08 13:49 [PATCH v2 0/4] git-gui blame: use textconv Clément Poulain
2010-06-08 13:49 ` [PATCH v2 1/4] sha1_name: add get_sha1_with_context() Clément Poulain
2010-06-08 13:49   ` [PATCH v2 2/4] textconv: support for cat_file Clément Poulain
2010-06-08 13:49     ` [PATCH v2 3/4] git gui: use textconv filter for diff and blame Clément Poulain
2010-06-08 13:49       ` [PATCH v2 4/4] t/t8007: test textconv support for cat-file Clément Poulain
2010-06-08 18:12     ` Matthieu Moy [this message]
2010-06-08 17:57   ` [PATCH v2 1/4] sha1_name: add get_sha1_with_context() Matthieu Moy
2010-06-08 22:30     ` Clément Poulain
2010-06-09  6:13       ` Jeff King
2010-06-09  7:29         ` Matthieu Moy

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=vpq7hm95r7h.fsf@bauges.imag.fr \
    --to=matthieu.moy@grenoble-inp.fr \
    --cc=axel.bonnet@ensimag.imag.fr \
    --cc=clement.poulain@ensimag.imag.fr \
    --cc=diane.gasselin@ensimag.imag.fr \
    --cc=git@vger.kernel.org \
    /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).