git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Lea Wiemann <lewiemann@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] cat-file --batch / --batch-check: do not exit if hashes are missing
Date: Mon, 09 Jun 2008 16:23:07 +0200	[thread overview]
Message-ID: <484D3CCB.1000508@viscovery.net> (raw)
In-Reply-To: <1212967717-5165-1-git-send-email-LeWiemann@gmail.com>

Lea Wiemann schrieb:
> Previously, cat-file --batch / --batch-check would silently exit if it
> was passed a non-existent SHA1 on stdin.  Now it prints "<SHA1>
> missing" as in all other cases (and as advertised in the
> documentation).

Makes sense!

> diff --git a/builtin-cat-file.c b/builtin-cat-file.c
> index f8b3160..112b9db 100644
> --- a/builtin-cat-file.c
> +++ b/builtin-cat-file.c
> @@ -168,8 +168,11 @@ static int batch_one_object(const char *obj_name, int print_contents)
>  	else
>  		type = sha1_object_info(sha1, &size);
>  
> -	if (type <= 0)
> -		return 1;
> +	if (type <= 0) {
> +		printf("%s missing\n", obj_name);
> +		fflush(stdout);
> +		return 0;
> +	}

With this change an invalid name and a non-existing SHA1 are treated as
"missing". But an empty name is still an error, which we don't see here
because it's outside the hunk's context: It is the first thing that the
function checks, and there it exits with return 1. Why is this case still
special?

-- Hannes

  parent reply	other threads:[~2008-06-09 14:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-08 23:28 [PATCH] cat-file --batch / --batch-check: do not exit if hashes are missing Lea Wiemann
2008-06-08 23:34 ` Johannes Schindelin
2008-06-09  0:05   ` Lea Wiemann
2008-06-09  1:02     ` Johannes Schindelin
2008-06-09 10:17       ` Lea Wiemann
2008-06-09 11:07         ` Jakub Narebski
2008-06-09 13:27           ` Lea Wiemann
2008-06-09  0:02 ` [PATCH v2] " Lea Wiemann
2008-06-09 20:37   ` Junio C Hamano
2008-06-09 20:42   ` Junio C Hamano
2008-06-09 14:23 ` Johannes Sixt [this message]
2008-06-09 18:21   ` [PATCH] " Lea Wiemann

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

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

  git send-email \
    --in-reply-to=484D3CCB.1000508@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=lewiemann@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.
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 NNTP newsgroup(s).