Move refs/cache-automerge/ generation logic to RefNames

Change-Id: Id9b0c1364484205d435cb2f35469a0d95e439757
This commit is contained in:
Dave Borowitz 2016-10-31 15:10:12 -04:00
parent 9acdc6ec0a
commit 7d8667d2cf
2 changed files with 8 additions and 5 deletions

View File

@ -140,6 +140,13 @@ public class RefNames {
return r;
}
public static String refsCacheAutomerge(String hash) {
return REFS_CACHE_AUTOMERGE
+ hash.substring(0, 2)
+ '/'
+ hash.substring(2);
}
public static String shard(int id) {
if (id < 0) {
return null;

View File

@ -96,11 +96,7 @@ public class AutoMerger {
}
rw.parseHeaders(merge);
String hash = merge.name();
String refName = RefNames.REFS_CACHE_AUTOMERGE
+ hash.substring(0, 2)
+ "/"
+ hash.substring(2);
String refName = RefNames.refsCacheAutomerge(merge.name());
Ref ref = repo.getRefDatabase().exactRef(refName);
if (ref != null && ref.getObjectId() != null) {
RevObject obj = rw.parseAny(ref.getObjectId());