> Jonathan Tan <jonathanta...@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).

> 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.jonathanta...@google.com/

Reply via email to