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

Re: [PATCH v2 2/2] receive-pack: detect aliased updates which can occur with symrefs

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 19, 2010, 20:39 UTC
Message-ID
<7veiibqirf.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1271695179-32131-1-git-send-email-jaysoffian@gmail.com>
Jay Soffian <jaysoffian@gmail.com> writes:
Show 12 quoted lines
> @@ -503,9 +562,11 @@ static void execute_commands(struct command *commands, const char *unpacker_erro
>  		return;
>  	}
>  
> +	check_aliased_updates(commands);
> +
>  	head_name = resolve_ref("HEAD", sha1, 0, NULL);
>  
> -	for (cmd = commands; cmd; cmd = cmd->next)
> +	for (cmd = commands; cmd && !cmd->skip_update; cmd = cmd->next)
>  		cmd->error_string = update(cmd);
>  }

Do you really mean to have "skip-update" check as the loop termination condition like this (i.e. "upon seeing any skip-update, abandon the rest of the update queue"), or is this a typo of "skip this entry but keep going, processing the rest" that should have been a separate "if" in the body of the loop?

Show 7 quoted lines
> @@ -545,6 +606,7 @@ static struct command *read_head_info(void)
>  		hashcpy(cmd->old_sha1, old_sha1);
>  		hashcpy(cmd->new_sha1, new_sha1);
>  		memcpy(cmd->ref_name, line + 82, len - 81);
> +		cmd->skip_update = 0;
>  		cmd->error_string = NULL;
>  		cmd->next = NULL;

It would make sense to do xcalloc(nmemb, size) of one member of that length to allocate cmd at this point, instead of adding yet another assignment like this.

It also would help me a slight bit if you compared what has been queued with what you sent to catch minor differences between my expectation from this series and what you have (e.g. I'd like to keep this as a fix that is back-mergeable to 'maint' and also I have already done some style fixes to the test).

Thanks.
Previous: Jay SoffianNext: Jay Soffian
Message 5 of 17 in “receive-pack: switch global variable 'commands' to a parameter”
  1. 1/2 receive-pack: switch global variable 'commands' to a parameterJay Soffian, Apr 19, 2010
  2. 2/2 receive-pack: detect aliased updates which can occur with symrefsJay Soffian, Apr 19, 2010
  3. Jay SoffianApr 19, 2010
  4. 2/2 receive-pack: detect aliased updates which can occur with symrefsJay Soffian, Apr 19, 2010
  5. Junio C HamanoApr 19, 2010
  6. Jay SoffianApr 19, 2010
  7. 0/3 js/maint-receive-pack-symref-aliasJay Soffian, Apr 19, 2010
  8. 1/3 receive-pack: switch global variable 'commands' to a parameterJay Soffian, Apr 19, 2010
  9. 2/3 t5516-fetch-push.sh: style cleanupJay Soffian, Apr 19, 2010
  10. 3/3 receive-pack: detect aliased updates which can occur with symrefsJay Soffian, Apr 19, 2010
  11. ignoring a fetch that overwrites local symrefJunio C Hamano, Dec 11, 2012
  12. fetch: ignore wildcarded refspecs that update local symbolic refsJunio C Hamano, Dec 11, 2012
  13. Jay SoffianDec 12, 2012
  14. Shawn PearceDec 12, 2012
  15. Junio C HamanoDec 12, 2012
  16. 3/3 receive-pack: detect aliased updates which can occur with symrefsJay Soffian, Apr 19, 2010
  17. Ævar Arnfjörð BjarmasonJun 10, 2010

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.