diff options
author | Jeff King <peff@peff.net> | 2015-03-13 00:42:12 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-03-12 23:18:33 -0700 |
commit | e172755b1eeb061c8fafb5ae8e4e9e72f68a0cdd (patch) | |
tree | 989de5b7996438f8426abe17ee46b5b2b2c4a8b6 /t/t4000-diff-format.sh | |
parent | Merge branch 'maint-2.0' into maint-2.1 (diff) | |
download | tgif-e172755b1eeb061c8fafb5ae8e4e9e72f68a0cdd.tar.xz |
upload-pack: fix transfer.hiderefs over smart-http
When upload-pack advertises the refs (either for a normal,
non-stateless request, or for the initial contact in a
stateless one), we call for_each_ref with the send_ref
function as its callback. send_ref, in turn, calls
mark_our_ref, which checks whether the ref is hidden, and
sets OUR_REF or HIDDEN_REF on the object as appropriate. If
it is hidden, mark_our_ref also returns "1" to signal
send_ref that the ref should not be advertised.
If we are not advertising refs, (i.e., the follow-up
invocation by an http client to send its "want" lines), we
use mark_our_ref directly as a callback to for_each_ref. Its
marking does the right thing, but when it then returns "1"
to for_each_ref, the latter interprets this as an error and
stops iterating. As a result, we skip marking all of the
refs that come lexicographically after it. Any "want" lines
from the client asking for those objects will fail, as they
were not properly marked with OUR_REF.
To solve this, we introduce a wrapper callback around
mark_our_ref which always returns 0 (even if the ref is
hidden, we want to keep iterating). We also tweak the
signature of mark_our_ref to exclude unnecessary parameters
that were present only to conform to the callback interface.
This should make it less likely for somebody to accidentally
use it as a callback in the future.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4000-diff-format.sh')
0 files changed, 0 insertions, 0 deletions