This is in the set of things that we hope to upstream into JGit eventually, so move it out of this Gerrit-specific class. Change-Id: Id9c7fb5e3d8b27e4578f66f6f8d1451beceececa