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

Re: [PATCH v2] push: don't fetch commit object when checking existence

From
Junio C Hamano <gitster@pobox.com>
Date
May 22, 2024, 20:55 UTC
Message-ID
<xmqqed9t36sn.fsf@gitster.g>
In-Reply-To
<20240522201559.1677959-1-tom@compton.nu>
Tom Hughes <tom@compton.nu> writes:
Show 14 quoted lines
> diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh
> index 88a66f0904..7797391c03 100755
> --- a/t/t0410-partial-clone.sh
> +++ b/t/t0410-partial-clone.sh
> @@ -689,6 +689,25 @@ test_expect_success 'lazy-fetch when accessing object not in the_repository' '
>  	! grep "[?]$FILE_HASH" out
>  '
>  
> +test_expect_success 'push should not fetch new commit objects' '
> +	rm -rf server client &&
> +	test_create_repo server &&
> +	test_config -C server uploadpack.allowfilter 1 &&
> +	test_config -C server uploadpack.allowanysha1inwant 1 &&
> +	test_commit -C server server1 &&
OK, we create the source that allows a partial clone.
> +	git clone --filter=blob:none "file://$(pwd)/server" client &&
> +	test_commit -C client client1 &&
And make a clone out of it, without blobs.
> +	test_commit -C server server2 &&
> +	COMMIT=$(git -C server rev-parse server2) &&
Then we create a new commit that the client does not yet have.
> +	test_must_fail git -C client push 2>err &&
We try to overwrite it.  We expect it to fail with "not a fast forward".
> +	grep "fetch first" err &&

May want to use "test_grep" but this script does not use it, so being consistent with the surrounding tests is good.

> +	git -C client rev-list --objects --missing=print "$COMMIT" >objects &&
> +	grep "^[?]$COMMIT" objects
> +'
OK.
>  . "$TEST_DIRECTORY"/lib-httpd.sh
>  start_httpd
Looking good.  Thanks, will queue.
Previous: Tom HughesNext: Tom Hughes
Message 4 of 8 in “push: don't fetch commit object when checking existence”
  1. push: don't fetch commit object when checking existenceTom Hughes, May 22, 2024
  2. Junio C HamanoMay 22, 2024
  3. push: don't fetch commit object when checking existenceTom Hughes, May 22, 2024
  4. Junio C HamanoMay 22, 2024
  5. Tom HughesMay 22, 2024
  6. Junio C HamanoMay 22, 2024
  7. Jeff KingMay 23, 2024
  8. Tom HughesMay 22, 2024

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.