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

Re: [PATCH] fetch: when deepening, check connectivity fully

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 27, 2018, 20:17 UTC
Message-ID
<xmqqa7rgdlwf.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180627173237.25620-1-jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
Show 22 quoted lines
> +test_expect_success 'shallow fetches check connectivity without stopping at existing refs' '
> +	cp -R .git server.git &&
> +
> +	# Normally, the connectivity check stops at ancestors of existing refs.
> +	git init client &&
> +	GIT_TRACE="$(pwd)/trace" git -C client fetch "$(pwd)/server.git" &&
> +	grep "run_command: git rev-list" trace >rev-list-command &&
> +	grep -e "--not --all" rev-list-command &&
> +
> +	# But it does not for a shallow fetch...
> +	rm -rf client trace &&
> +	git init client &&
> +	GIT_TRACE="$(pwd)/trace" git -C client fetch --depth=1 "$(pwd)/server.git" &&
> +	grep "run_command: git rev-list" trace >rev-list-command &&
> +	! grep -e "--not --all" rev-list-command &&
> +
> +	# ...and when deepening.
> +	rm trace &&
> +	GIT_TRACE="$(pwd)/trace" git -C client fetch --unshallow "$(pwd)/server.git" &&
> +	grep "run_command: git rev-list" trace >rev-list-command &&
> +	! grep -e "--not --all" rev-list-command
> +'

Hmph, don't we quote these in the trace output, requiring us to grep for "'--not' '--all'" or somesuch?

I do not think of a better way to do the above without a huge effort offhand, and the approach taken by the above may be the best we could do, but it looks like quite a brittle test that knows too much about the current implementation. "rev-list $new_commits --not --all" is a so very common and useful pattern that it is not all that implausible that we may want to come up with a new option to do so, or more likely we may want to do that with an in-process API without spawning an external rev-list (hence making it impossible to observe via GIT_TRACE).

Previous: Jonathan TanNext: Jonathan Tan
Message 6 of 8 in “fetch: when deepening, check connectivity fully”
  1. fetch: when deepening, check connectivity fullyJonathan Tan, Jun 27, 2018
  2. Junio C HamanoJun 27, 2018
  3. Jonathan TanJun 27, 2018
  4. Junio C HamanoJun 27, 2018
  5. Jonathan TanJun 29, 2018
  6. Junio C HamanoJun 27, 2018
  7. Jonathan TanJun 27, 2018
  8. Junio C HamanoJun 27, 2018

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.