Performance Fix: Minimize number of advertisedHaves

While we set up hooks in ReceiveCommits to minimize the number of
advertised refs (for instance filtering out refs/changes and
refs/cache-automerge refs), their objectIds will still be added to
BaseReceivePack.advertisedHaves (JGit), leading to an unnecessarily
complex commit graph for JGit to traverse when checking for commit
connectivity in BaseReceivePack.checkConnectivity().

By filtering the refs before the objectIds are added to advertisedHaves,
lots of time can be saved when pushing to complex Gits.

Push times for one of our Gits (warm caches):

Before fix:
real	0m42.926s

After fix:
real	0m6.325s

This Git has around 90k change/ps refs.

Change-Id: I2f0a0830bd733f908f0aeaf1eaf0412dae428a16
Merge branch 'stable-2.6' into stable-2.7

* stable-2.6:
  Performance Fix: Minimize number of advertisedHaves

Change-Id: Id19a9ef22aa7445bf8188b79d34aeb870eadb988