From: Junio C Hamano <gitster@pobox.com>
To: Pang Yan Han <pangyanhan@gmail.com>
Cc: git@vger.kernel.org, Sitaram Chamarty <sitaramc@gmail.com>,
"Shawn O. Pearce" <spearce@spearce.org>,
Jeff King <peff@peff.net>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH/RFCv3 2/2] receive-pack: don't pass non-existent refs to post-{receive,update} hooks in push deletions
Date: Wed, 28 Sep 2011 15:37:32 -0700 [thread overview]
Message-ID: <7vsjngxphv.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20110928153935.GA7800@myhost> (Pang Yan Han's message of "Wed, 28 Sep 2011 23:39:35 +0800")
Pang Yan Han <pangyanhan@gmail.com> writes:
> +/* For invalid refs */
> +static struct command **invalid_delete;
> +static size_t invalid_delete_nr;
> +static size_t invalid_delete_alloc;
Do you have to have these separately only to keep track of the corner case
errors? I would have expected that it would be more natural to mark them
by adding a single bitfield to "struct command".
> @@ -447,6 +467,8 @@ static const char *update(struct command *cmd)
> if (!parse_object(old_sha1)) {
> rp_warning("Allowing deletion of corrupt ref.");
> old_sha1 = NULL;
> + if (!ref_exists((char *) name))
> + invalid_delete_append(cmd);
This is not an "invalid" delete but deleting a non-existing ref. Perhaps
you would want to move the warning and optionally reword it as well, e.g.
if (!parse_object(old_sha1)) {
old_sha1 = NULL;
if (ref_exists(name)) {
rp_warning("Allowing deletion of corrupt ref.");
} else {
rp_warning("Deleting a ref that does not exist.");
cmd->did_not_exist = 1;
}
...
next prev parent reply other threads:[~2011-09-28 23:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-28 15:39 [PATCH/RFCv3 2/2] receive-pack: don't pass non-existent refs to post-{receive,update} hooks in push deletions Pang Yan Han
2011-09-28 22:37 ` Junio C Hamano [this message]
2011-09-28 23:08 ` Pang Yan Han
2011-09-28 23:28 ` Junio C Hamano
2011-09-30 13:29 ` Pang Yan Han
2011-09-30 18:19 ` Junio C Hamano
2011-09-28 23:09 ` Junio C Hamano
2011-09-28 23:11 ` Pang Yan Han
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=7vsjngxphv.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=pangyanhan@gmail.com \
--cc=peff@peff.net \
--cc=sitaramc@gmail.com \
--cc=spearce@spearce.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.
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).