git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH/RFCv3 2/2] receive-pack: don't pass non-existent refs to post-{receive,update} hooks in push deletions

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 28, 2011, 22:37 UTC
Message-ID
<7vsjngxphv.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20110928153935.GA7800@myhost>
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".

Show 6 quoted lines
> @@ -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;
		}
		...
Previous: Pang Yan HanNext: Pang Yan Han
Message 2 of 8 in “receive-pack: don't pass non-existent refs to post-{receive,update} hooks in push deletions”
  1. 2/2 receive-pack: don't pass non-existent refs to post-{receive,update} hooks in push deletionsPang Yan Han, Sep 28, 2011
  2. Junio C HamanoSep 28, 2011
  3. Pang Yan HanSep 28, 2011
  4. Junio C HamanoSep 28, 2011
  5. Pang Yan HanSep 30, 2011
  6. Junio C HamanoSep 30, 2011
  7. Junio C HamanoSep 28, 2011
  8. Pang Yan HanSep 28, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.