aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2023-02-01 00:30:52 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2023-02-01 00:33:20 +0100
commitda21265a141b68ea3069afd79107f7d374027bc0 (patch)
tree5dbbe3c3e63c42ece49858c38c33b2804b3a48d3 /org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
parent41b33a16b87dbc7246f81089ef58f4bb530e4b1d (diff)
parent21e902dd7fa4ff53dc35fd7c48f8b5edc52f8eea (diff)
downloadjgit-da21265a141b68ea3069afd79107f7d374027bc0.tar.gz
jgit-da21265a141b68ea3069afd79107f7d374027bc0.zip
Merge branch 'stable-5.13' into stable-6.0
* stable-5.13: Shortcut during git fetch for avoiding looping through all local refs FetchCommand: fix fetchSubmodules to work on a Ref to a blob Silence API warnings introduced by I466dcde6 Allow the exclusions of refs prefixes from bitmap PackWriterBitmapPreparer: do not include annotated tags in bitmap BatchingProgressMonitor: avoid int overflow when computing percentage Speedup GC listing objects referenced from reflogs FileSnapshotTest: Add more MISSING_FILE coverage Change-Id: I58ad4c210a5e7e5a1ba6b22315b04211c8909950
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
index 2b4deb32f0..1c1aa7b310 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java
@@ -46,6 +46,7 @@ import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefDatabase;
import org.eclipse.jgit.revwalk.ObjectWalk;
+import org.eclipse.jgit.revwalk.RevObject;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.util.StringUtils;
@@ -377,11 +378,19 @@ class FetchProcess {
private boolean askForIsComplete() throws TransportException {
try {
try (ObjectWalk ow = new ObjectWalk(transport.local)) {
- for (ObjectId want : askFor.keySet())
- ow.markStart(ow.parseAny(want));
- for (Ref ref : localRefs().values())
- ow.markUninteresting(ow.parseAny(ref.getObjectId()));
- ow.checkConnectivity();
+ boolean hasCommitObject = false;
+ for (ObjectId want : askFor.keySet()) {
+ RevObject obj = ow.parseAny(want);
+ ow.markStart(obj);
+ hasCommitObject |= obj.getType() == Constants.OBJ_COMMIT;
+ }
+ // Checking connectivity makes sense on commits only
+ if (hasCommitObject) {
+ for (Ref ref : localRefs().values()) {
+ ow.markUninteresting(ow.parseAny(ref.getObjectId()));
+ }
+ ow.checkConnectivity();
+ }
}
return true;
} catch (MissingObjectException e) {