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

Re: [PATCH] upload-pack: only accept commits from "shallow" line

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 8, 2013, 17:27 UTC
Message-ID
<7vfw2bfuut.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1357644756-18205-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 10 quoted lines
> We only allow cuts at commits, not arbitrary objects. upload-pack will
> fail eventually in register_shallow if a non-commit is given with a
> generic error "Object %s is a %s, not a commit". Check it early and
> give a more accurate error.
>
> This should never show up in an ordinary session. It's for buggy
> clients, or when the user manually edits .git/shallow.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---

Thanks. I agree with you that while this is not wrong per-se, this will not matter in real life.

Show 16 quoted lines
>  upload-pack.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/upload-pack.c b/upload-pack.c
> index 6142421..95d8313 100644
> --- a/upload-pack.c
> +++ b/upload-pack.c
> @@ -603,6 +603,8 @@ static void receive_needs(void)
>  			object = parse_object(sha1);
>  			if (!object)
>  				die("did not find object for %s", line);
> +			if (object->type != OBJ_COMMIT)
> +				die("invalid shallow object %s", sha1_to_hex(sha1));
>  			object->flags |= CLIENT_SHALLOW;
>  			add_object_array(object, NULL, &shallows);
>  			continue;
Previous: Nguyễn Thái Ngọc Duy
Message 2 of 2 in “upload-pack: only accept commits from "shallow" line”
  1. upload-pack: only accept commits from "shallow" lineNguyễn Thái Ngọc Duy, Jan 8, 2013
  2. Junio C HamanoJan 8, 2013

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.