Use commit IDs for download commands when change refs are hidden

Git has a configuration option to hide refs from the initial
advertisement (uploadpack.hideRefs). This option can be used to hide
the change refs from the client. As consequence fetching changes by
change ref is not working anymore. However by setting
uploadpack.allowTipSha1InWant to true fetching changes by commit ID is
possible. Adapt the git download commands so that they use the commit
ID instead of the change ref when a project is configured like this.
If tools use the download commands that are returned by the Gerrit
server, switching on this configuration should be transparent for

Example git configuration in a project:

    hideRefs = refs/changes/
    hideRefs = refs/cache-automerge/
    allowTipSha1InWant = true

The download commands only check for hidden change refs if this is
explicitly enabled by setting download.checkForHiddenChangeRefs in the
gerrit.config to true. This is because for servers that do not have
any projects with hidden change refs this check is unneeded. The
documentation of this new config option will be added in Gerrit core,
since for historic reasons all download configuration parameters are
described there and it wouldn't make sense to document a single
parameter in another place.

Bug: Issue 175
Change-Id: I0f1f68c856f23ffeddd0e833bf45b31549cfd6f2
Signed-off-by: Edwin Kempin <>
6 files changed
tree: 7ba2f1b3d3ce8d7293c8ab4139ea73b976ad7de4
  1. src/
  2. .gitignore
  3. BUCK