git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lea Wiemann <lewiemann@gmail.com>
To: Johannes Sixt <j.sixt@viscovery.net>
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 20:21:09 +0200	[thread overview]
Message-ID: <484D7495.3020407@gmail.com> (raw)
In-Reply-To: <484D3CCB.1000508@viscovery.net>

Johannes Sixt wrote:
> With this change an invalid name and a non-existing SHA1 are treated as
> "missing". But an empty name is still an error  [...]: It is the first thing
> that the function checks, and there it exits with return 1.

An empty object name is actually not an error but just yields "SP 
missing".  The "if (!obj_name) return 1;" statement doesn't dereference 
obj_name, so it checks for null pointers.  However, batch_one_object 
gets called with buf.buf as its obj_name parameter, which according to 
api-strbuf.txt is never NULL.  So probably the check is pointless and 
can be removed (the tests still pass); someone more knowledgeable than 
me should confirm this though.

(FWIW, perhaps the original author intended to catch empty input this 
way, but I'm not convinced that this is even sensible.)

Unrelatedly, does anyone know how to stop sha1_object_info from barfing 
on non-existent hashes?  It causes the annoying "error: unable to find 
000..." on stderr if you run "echo 
0000000000000000000000000000000000000000 | git-cat-file --batch-check".

-- Lea

      reply	other threads:[~2008-06-09 18:22 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 ` [PATCH] " Johannes Sixt
2008-06-09 18:21   ` Lea Wiemann [this message]

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=484D7495.3020407@gmail.com \
    --to=lewiemann@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j.sixt@viscovery.net \
    /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).