Upgrade JGit to latest master
63fc6970c - Suppress the API errors introduced by 3e9a5f99 57bb09ade - ReceivePack: Remove unused getLockMessageProcessName method b89e5ecc9 - ReceivePack: Remove unnecessary ReceivePack. prefix on static call 3e9a5f993 - transport: Merge BaseReceivePack into ReceivePack Adjust to the removal of BaseReceivePack. Change-Id: I19989bcc710757130509470b971876548a07805a
This commit is contained in:
@@ -19,7 +19,7 @@ import static java.util.stream.Collectors.toMap;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import org.eclipse.jgit.lib.Ref;
|
||||
import org.eclipse.jgit.transport.BaseReceivePack;
|
||||
import org.eclipse.jgit.transport.ReceivePack;
|
||||
import org.eclipse.jgit.transport.ServiceMayNotContinueException;
|
||||
|
||||
/** Static utilities for writing git protocol hooks. */
|
||||
@@ -32,8 +32,7 @@ public class HookUtil {
|
||||
* @return map of refs that were advertised.
|
||||
* @throws ServiceMayNotContinueException if a problem occurred.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Map<String, Ref> ensureAllRefsAdvertised(BaseReceivePack rp)
|
||||
public static Map<String, Ref> ensureAllRefsAdvertised(ReceivePack rp)
|
||||
throws ServiceMayNotContinueException {
|
||||
Map<String, Ref> refs = rp.getAdvertisedRefs();
|
||||
if (refs != null) {
|
||||
|
@@ -20,7 +20,7 @@ import com.google.gerrit.server.git.HookUtil;
|
||||
import java.util.Map;
|
||||
import org.eclipse.jgit.lib.Ref;
|
||||
import org.eclipse.jgit.transport.AdvertiseRefsHook;
|
||||
import org.eclipse.jgit.transport.BaseReceivePack;
|
||||
import org.eclipse.jgit.transport.ReceivePack;
|
||||
import org.eclipse.jgit.transport.ServiceMayNotContinueException;
|
||||
import org.eclipse.jgit.transport.UploadPack;
|
||||
|
||||
@@ -34,7 +34,7 @@ class AllRefsWatcher implements AdvertiseRefsHook {
|
||||
private Map<String, Ref> allRefs;
|
||||
|
||||
@Override
|
||||
public void advertiseRefs(BaseReceivePack rp) throws ServiceMayNotContinueException {
|
||||
public void advertiseRefs(ReceivePack rp) throws ServiceMayNotContinueException {
|
||||
allRefs = HookUtil.ensureAllRefsAdvertised(rp);
|
||||
}
|
||||
|
||||
|
@@ -28,7 +28,7 @@ import org.eclipse.jgit.lib.Ref;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
import org.eclipse.jgit.revwalk.RevWalk;
|
||||
import org.eclipse.jgit.transport.AdvertiseRefsHook;
|
||||
import org.eclipse.jgit.transport.BaseReceivePack;
|
||||
import org.eclipse.jgit.transport.ReceivePack;
|
||||
import org.eclipse.jgit.transport.ServiceMayNotContinueException;
|
||||
import org.eclipse.jgit.transport.UploadPack;
|
||||
|
||||
@@ -72,9 +72,8 @@ public class HackPushNegotiateHook implements AdvertiseRefsHook {
|
||||
throw new UnsupportedOperationException("HackPushNegotiateHook cannot be used for UploadPack");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void advertiseRefs(BaseReceivePack rp) throws ServiceMayNotContinueException {
|
||||
public void advertiseRefs(ReceivePack rp) throws ServiceMayNotContinueException {
|
||||
Map<String, Ref> r = rp.getAdvertisedRefs();
|
||||
if (r == null) {
|
||||
try {
|
||||
@@ -90,14 +89,13 @@ public class HackPushNegotiateHook implements AdvertiseRefsHook {
|
||||
rp.setAdvertisedRefs(r, history(r.values(), rp));
|
||||
}
|
||||
|
||||
private Set<ObjectId> history(Collection<Ref> refs, BaseReceivePack rp) {
|
||||
private Set<ObjectId> history(Collection<Ref> refs, ReceivePack rp) {
|
||||
Set<ObjectId> alreadySending = rp.getAdvertisedObjects();
|
||||
if (MAX_HISTORY <= alreadySending.size()) {
|
||||
return alreadySending;
|
||||
}
|
||||
|
||||
// Scan history until the advertisement is full.
|
||||
@SuppressWarnings("deprecation")
|
||||
RevWalk rw = rp.getRevWalk();
|
||||
rw.reset();
|
||||
try {
|
||||
|
@@ -36,7 +36,7 @@ import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.lib.Ref;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.transport.AdvertiseRefsHook;
|
||||
import org.eclipse.jgit.transport.BaseReceivePack;
|
||||
import org.eclipse.jgit.transport.ReceivePack;
|
||||
import org.eclipse.jgit.transport.ServiceMayNotContinueException;
|
||||
import org.eclipse.jgit.transport.UploadPack;
|
||||
|
||||
@@ -78,9 +78,8 @@ public class ReceiveCommitsAdvertiseRefsHook implements AdvertiseRefsHook {
|
||||
"ReceiveCommitsAdvertiseRefsHook cannot be used for UploadPack");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void advertiseRefs(BaseReceivePack rp) throws ServiceMayNotContinueException {
|
||||
public void advertiseRefs(ReceivePack rp) throws ServiceMayNotContinueException {
|
||||
Map<String, Ref> advertisedRefs = HookUtil.ensureAllRefsAdvertised(rp);
|
||||
advertisedRefs.keySet().stream()
|
||||
.filter(ReceiveCommitsAdvertiseRefsHook::skip)
|
||||
|
Submodule modules/jgit updated: fd798d326e...63fc6970cc
Reference in New Issue
Block a user