diff --git a/launchable/jar/exe_deploy.jar b/launchable/jar/exe_deploy.jar index 81b1f99d3..c725d5e3c 100755 Binary files a/launchable/jar/exe_deploy.jar and b/launchable/jar/exe_deploy.jar differ diff --git a/src/main/java/com/launchableinc/ingest/commits/CommitGraphCollector.java b/src/main/java/com/launchableinc/ingest/commits/CommitGraphCollector.java index 6e43a237f..a4350712f 100644 --- a/src/main/java/com/launchableinc/ingest/commits/CommitGraphCollector.java +++ b/src/main/java/com/launchableinc/ingest/commits/CommitGraphCollector.java @@ -1,8 +1,5 @@ package com.launchableinc.ingest.commits; -import static com.google.common.collect.ImmutableList.toImmutableList; -import static java.util.Arrays.*; - import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; @@ -11,26 +8,6 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.ImmutableList; import com.google.common.io.CharStreams; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.Closeable; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.UncheckedIOException; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.Objects; -import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; -import java.util.function.Supplier; -import java.util.stream.Collectors; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; import org.apache.http.Header; import org.apache.http.HttpResponse; import org.apache.http.client.methods.CloseableHttpResponse; @@ -58,6 +35,30 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.Closeable; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.UncheckedIOException; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; +import java.util.function.Supplier; +import java.util.stream.Collectors; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +import static com.google.common.collect.ImmutableList.*; +import static java.util.Arrays.*; + /** * Compares what commits the local repository and the remote repository have, then send delta over. */ @@ -293,10 +294,12 @@ final class ByRepository implements AutoCloseable { private final Repository git; private final ObjectReader objectReader; + private final Set shallowCommits; - ByRepository(Repository git) { + ByRepository(Repository git) throws IOException { this.git = git; this.objectReader = git.newObjectReader(); + this.shallowCommits = objectReader.getShallowCommits(); } /** @@ -411,12 +414,18 @@ private JSCommit transform(RevCommit r) throws IOException { ConfigConstants.CONFIG_KEY_ALGORITHM, SupportedAlgorithm.HISTOGRAM); + if (LCHIB544) { System.err.printf("Commit %s parents=%s%n", r.name(), stream(r.getParents()).map(AnyObjectId::name).collect(Collectors.joining(","))); } + if (shallowCommits.contains(r)) { + c.setShallow(true); + warnMissingObject(); + } + for (RevCommit p : r.getParents()) { CountingDiffFormatter diff = new CountingDiffFormatter(git); List files = diff.scan(p.getTree(), r.getTree()); @@ -431,10 +440,7 @@ private JSCommit transform(RevCommit r) throws IOException { p.abbreviate(7).name(), r.abbreviate(7).name() ); - if (!warnMissingObject) { - warnMissingObject = true; - System.err.println("See https://www.launchableinc.com/missing-git-object-during-commit-collection"); - } + warnMissingObject(); } catch (IOException e) { logger.warn("Failed to process a change to a file", e); } @@ -449,6 +455,13 @@ private JSCommit transform(RevCommit r) throws IOException { return c; } + private void warnMissingObject() { + if (!warnMissingObject) { + warnMissingObject = true; + System.err.println("See https://www.launchableinc.com/missing-git-object-during-commit-collection"); + } + } + @Override public void close() { objectReader.close(); diff --git a/src/main/java/com/launchableinc/ingest/commits/JSCommit.java b/src/main/java/com/launchableinc/ingest/commits/JSCommit.java index 715a11937..5f0b6800a 100644 --- a/src/main/java/com/launchableinc/ingest/commits/JSCommit.java +++ b/src/main/java/com/launchableinc/ingest/commits/JSCommit.java @@ -34,6 +34,9 @@ public class JSCommit { /** Commit message. */ private String message; + /** This object was marked as shallow and therefore its parent commits are not available. */ + private boolean shallow; + private Map> parentHashes = new HashMap<>(); public String getCommitHash() { @@ -107,4 +110,12 @@ public String getMessage() { public void setMessage(String message) { this.message = message; } + + public boolean isShallow() { + return shallow; + } + + public void setShallow(boolean shallow) { + this.shallow = shallow; + } }