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

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

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Jun 27, 2018, 22:51 UTC
Message-ID
<20180627225105.155996-1-jonathantanmy@google.com>
In-Reply-To
<xmqqa7rgdlwf.fsf@gitster-ct.c.googlers.com>
Show 27 quoted lines
> Jonathan Tan <jonathantanmy@google.com> writes:
> 
> > +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 thought so too, but this was changed in commit 1fbdab21bb ("trace: avoid unnecessary quoting", 2018-01-16).

Show 9 quoted lines
> 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).

I agree. The best way to do it would probably be to intercept the fetch response and substitute an empty packfile for the packfile returned by the fetch, like the one-time-sed mechanism [1], but I think that it is outside the scope of this patch.

[1] https://public-inbox.org/git/afe5d7d3f876893fdad318665805df1e056717c6.1485381677.git.jonathantanmy@google.com/
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 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.