Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified launchable/jar/exe_deploy.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -293,10 +294,12 @@ final class ByRepository implements AutoCloseable {
private final Repository git;

private final ObjectReader objectReader;
private final Set<ObjectId> shallowCommits;

ByRepository(Repository git) {
ByRepository(Repository git) throws IOException {
this.git = git;
this.objectReader = git.newObjectReader();
this.shallowCommits = objectReader.getShallowCommits();
}

/**
Expand Down Expand Up @@ -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<DiffEntry> files = diff.scan(p.getTree(), r.getTree());
Expand All @@ -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);
}
Expand All @@ -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();
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/launchableinc/ingest/commits/JSCommit.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, List<JSFileChange>> parentHashes = new HashMap<>();

public String getCommitHash() {
Expand Down Expand Up @@ -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;
}
}