Skip to content

Commit

Permalink
Update git-lfs-java to 0.5.0 (fix #4: multithread uploading)
Browse files Browse the repository at this point in the history
  • Loading branch information
bozaro committed Oct 23, 2015
1 parent fce590d commit d2fd13d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ dependencies {
compile "org.jgrapht:jgrapht-core:0.9.1"
compile "com.beust:jcommander:1.35"

compile "ru.bozaro.gitlfs:gitlfs-pointer:0.4.0"
compile "ru.bozaro.gitlfs:gitlfs-client:0.4.0"
compile "ru.bozaro.gitlfs:gitlfs-pointer:0.5.0"
compile "ru.bozaro.gitlfs:gitlfs-client:0.5.0"

testCompile "org.testng:testng:6.8.8"
}
Expand Down
12 changes: 4 additions & 8 deletions src/main/java/git/lfs/migrate/GitConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.stream.Collectors;

/**
* Converter for git objects.
Expand Down Expand Up @@ -208,11 +209,7 @@ private boolean isFile(@NotNull FileMode fileMode) {
@NotNull
@Override
public Iterable<TaskKey> depends() throws IOException {
final List<TaskKey> result = new ArrayList<>();
for (GitTreeEntry entry : getEntries()) {
result.add(entry.getTaskKey());
}
return result;
return getEntries().stream().map(GitTreeEntry::getTaskKey).collect(Collectors.toList());
}

@NotNull
Expand Down Expand Up @@ -338,9 +335,8 @@ private static MessageDigest createSha256() {
}

private boolean isLfsPointer(@NotNull ObjectLoader loader) {
if (loader.getSize() > ru.bozaro.gitlfs.pointer.Constants.POINTER_MAX_SIZE) return false;
if (Pointer.parsePointer(loader.getBytes()) == null) return false;
return true;
return loader.getSize() <= ru.bozaro.gitlfs.pointer.Constants.POINTER_MAX_SIZE
&& Pointer.parsePointer(loader.getBytes()) != null;
}

@NotNull
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/git/lfs/migrate/GitTreeEntry.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,9 @@ public boolean equals(Object o) {

GitTreeEntry that = (GitTreeEntry) o;

if (!fileMode.equals(that.fileMode)) return false;
if (!taskKey.equals(that.taskKey)) return false;
if (!fileName.equals(that.fileName)) return false;

return true;
return fileMode.equals(that.fileMode)
&& taskKey.equals(that.taskKey)
&& fileName.equals(that.fileName);
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/git/lfs/migrate/TaskKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public boolean equals(Object o) {

TaskKey taskKey = (TaskKey) o;

if (type != taskKey.type) return false;
return objectId.equals(taskKey.objectId);
return (type == taskKey.type)
&& objectId.equals(taskKey.objectId);

}

Expand Down

0 comments on commit d2fd13d

Please sign in to comment.