The tests for receive commits ref advertising were further away from
reality than they should have been. In essence, they tested
ReceiveCommitsAdvertiseRefsHook directly, which let room for bugs to
creep in.
Most prominently, we filter metadata for pushes. As metadata we see
refs/changes/* and refs/cache-automerge/* (suboptimal naming is a
concern not addressed by this commit).
When the previous ref filter has already filtered out change refs
then ReceiveCommitsAdvertiseRefsHook became a no-op and did not
advertise the additional .haves it should because of a check for
existence based on the previously advertised refs.
This commit:
- Fixes the aforementioned bug
- Brings tests closer to reality by including the whole advertising
chain, have JGit do the actual advertising and assert on that
- Document the desired behavior
Change-Id: I230e66eee5b94c6f62b0426e5c16849d993a1cfe