Files
gerrit/java
Patrick Hiesel 3ceb65aaf0 Move addition of refs/users/self symlink out of filtering logic
Gerrit moved to a model where it wraps around RefDatabase to tell JGit
which refs are visible to a user. This was done in I0bb85de2b. This
meant moving filtering code from a AdvertiseRefsHook into a wrapper of
RefDatabase.

There is one case in which the logic that got moved would not only
filter refs but add a ref in addition that is not present in the input:
when authenticated users interact with All-Users. In this case, Gerrit
adds a refs/users/self symbolic reference to make it easier to interact
with one's account data.

This led to a problem with the new inferface and smelled as a whole
since concerns weren't clearly separated. The problem with the new
interface would occur when using RefDatabase#exactRef - a method that
expects {0,1} refs but got two for All-Users since refs/users/self was
added.

This change fixes the issue by separating the addition of the symref
into an AdvertiseRefsHook and leaving ref filtering by just that.

RefAdvertisementIT has different tests for testing the advertisement of
refs/users/self and PushAccountIT covers push cases. The tests succeeded
before, because the problem could only be encountered when the in-memory
ref cache on the push path is not used. We add a config to run push tests
without in-memory ref cache to make sure the code path that failed
previosuly gets executed now.

Bug: Issue 12027
Change-Id: I07777b698ddb86ad5cec1407ac5671874866fee5
2020-03-09 15:20:28 +09:00
..