Merge branch 'stable-3.1'
* stable-3.1: Set version to 3.1.1-SNAPSHOT Set version to 3.1.0 Upgrade JGit to latest master Upgrade gitiles-servlet and blame-cache to 0.3-6 Add sshd-common to lib/nongoogle_test.sh Increase 'execution.defaultThreadPoolSize' default and min to 2 Upgrade gitiles-servlet and blame-cache to 0.2-11 Fix formatting of submission IDs LazyPostReceiveHookChain: Simplify check for pack size Update highlight.js ChangeNotesParser: Skip parsing meta data of deleted patch sets Add a --header-box-shadow theme css variable Don't allow "show 2 more" reviewers Bazel: Expedite the LC process Update Jgit to latest master revision Move tooltip to below the button for change detail actions LazyPostReceiveHookChain: Catch IllegalStateException on ReceivePack.getPackSize Change-Id: I8e118de48a692ef60171d4f4d26f69bafb330c70
This commit is contained in:
@@ -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 {
|
||||
|
@@ -61,7 +61,7 @@ public class LazyPostReceiveHookChain implements PostReceiveHook {
|
||||
@Override
|
||||
public void onPostReceive(ReceivePack rp, Collection<ReceiveCommand> commands) {
|
||||
hooks.runEach(h -> h.onPostReceive(rp, commands));
|
||||
if (affectsSize(rp, commands)) {
|
||||
if (affectsSize(rp)) {
|
||||
QuotaResponse.Aggregated a =
|
||||
quotaBackend
|
||||
.user(user)
|
||||
@@ -78,10 +78,7 @@ public class LazyPostReceiveHookChain implements PostReceiveHook {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean affectsSize(ReceivePack rp, Collection<ReceiveCommand> commands) {
|
||||
if (commands.stream().allMatch(c -> c.getType() == ReceiveCommand.Type.DELETE)) {
|
||||
return false;
|
||||
}
|
||||
return rp.getPackSize() > 0L;
|
||||
public static boolean affectsSize(ReceivePack rp) {
|
||||
return rp.hasReceivedPack() && rp.getPackSize() > 0L;
|
||||
}
|
||||
}
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user