THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

dependency: Update jgit and play

Play: 2.3.6 -> 2.3.10
jgit: 3.5 -> 4.5
tags/v1.2.0
Suwon Chae 2 years ago
parent
commit
f3240682db
8 changed files with 78 additions and 30 deletions
  1. +4
    -3
      app/Global.java
  2. +2
    -2
      app/models/PullRequest.java
  3. +7
    -7
      app/playRepository/BareCommit.java
  4. +2
    -2
      app/playRepository/BareRepository.java
  5. +47
    -9
      app/playRepository/GitRepository.java
  6. +6
    -0
      app/utils/diff_match_patch.java
  7. +9
    -6
      build.sbt
  8. +1
    -1
      project/plugins.sbt

+ 4
- 3
app/Global.java View File

@@ -27,7 +27,6 @@ import controllers.routes;
import mailbox.MailboxService;
import models.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.impl.cookie.DateUtils;
import play.Application;
import play.Configuration;
import play.GlobalSettings;
@@ -58,7 +57,9 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.SecureRandom;
import java.util.Date;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

import static play.data.Form.form;
import static play.mvc.Results.badRequest;
@@ -185,7 +186,7 @@ public class Global extends GlobalSettings {
} catch (Exception e) {
play.Logger.warn("Failed to update the preferred language", e);
}
ctx.response().setHeader("Date", DateUtils.formatDate(new Date()));
ctx.response().setHeader("Date", DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.now(ZoneId.of("GMT"))));
ctx.response().setHeader("Cache-Control", "no-cache");
Promise<Result> promise = delegate.call(ctx);
AccessLogger.log(request, promise, start);


+ 2
- 2
app/models/PullRequest.java View File

@@ -434,7 +434,7 @@ public class PullRequest extends Model implements ResourceConvertible {
String refName = getNameOfRefToMerged();
RevCommit commit = null;
try {
ObjectId objectId = getRepository().getRef(refName).getObjectId();
ObjectId objectId = getRepository().findRef(refName).getObjectId();
commit = new RevWalk(getRepository()).parseCommit(objectId);
} catch (Exception e) {
play.Logger.info("Failed to get the merged branch", e);
@@ -471,7 +471,7 @@ public class PullRequest extends Model implements ResourceConvertible {
ObjectInserter inserter = getRepository().newObjectInserter();
mergeCommitId = inserter.insert(mergeCommit);
inserter.flush();
inserter.release();
inserter.close();

return new MergeRefUpdate(mergeCommitId, whoMerges);
}


+ 7
- 7
app/playRepository/BareCommit.java View File

@@ -89,7 +89,7 @@ public class BareCommit {
} catch (OverlappingFileLockException e) {
play.Logger.error("Overlapping File Lock Error: " + e.getMessage());
} finally {
objectInserter.release();
objectInserter.close();
repository.close();
refHeadFileLock.release();
}
@@ -193,7 +193,7 @@ public class BareCommit {
}

private boolean hasOldCommit(String refName) throws IOException {
return this.repository.getRef(refName).getObjectId() != null;
return this.repository.findRef(refName).getObjectId() != null;
}

private PersonIdent getPersonIdent() {
@@ -215,18 +215,18 @@ public class BareCommit {
}

public void setHeadObjectId(String refName) throws IOException {
if(this.repository.getRef(refName).getObjectId() == null){
if(this.repository.findRef(refName).getObjectId() == null){
this.headObjectId = ObjectId.zeroId();
} else {
this.headObjectId = this.repository.getRef(refName).getObjectId();
this.headObjectId = this.repository.findRef(refName).getObjectId();
}
}

public ObjectId getCurrentMomentHeadObjectId() throws IOException {
if( this.repository.getRef(refName).getObjectId() == null ){
if( this.repository.findRef(refName).getObjectId() == null ){
return ObjectId.zeroId();
} else {
return this.repository.getRef(refName).getObjectId();
return this.repository.findRef(refName).getObjectId();
}
}

@@ -245,7 +245,7 @@ public class BareCommit {
}

refHeadFile = new File(repository.getDirectory().getPath(),
repository.getRef(refName).getLeaf().getName());
repository.findRef(refName).getLeaf().getName());
if(refHeadFile.exists()){
channel = new RandomAccessFile(refHeadFile, "rw").getChannel();
lock = channel.lock();


+ 2
- 2
app/playRepository/BareRepository.java View File

@@ -76,7 +76,7 @@ public class BareRepository {

public static ObjectId getFileObjectId(Repository repository, String fileNameWithPath) throws IOException {
TreeWalk treeWalk = new TreeWalk(repository);
RevTree revTree = getRevTreeFromRef(repository, repository.getRef(HEAD));
RevTree revTree = getRevTreeFromRef(repository, repository.findRef(HEAD));
if( revTree == null ){
return ObjectId.zeroId();
}
@@ -88,7 +88,7 @@ public class BareRepository {

private static ObjectId getFirstFoundREADMEfileObjectId(Repository repository) throws IOException {
TreeWalk treeWalk = new TreeWalk(repository);
RevTree revTree = getRevTreeFromRef(repository, repository.getRef(HEAD));
RevTree revTree = getRevTreeFromRef(repository, repository.findRef(HEAD));
if( revTree == null ){
return ObjectId.zeroId();
}


+ 47
- 9
app/playRepository/GitRepository.java View File

@@ -38,10 +38,14 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.LogCommand;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.attributes.AttributesNode;
import org.eclipse.jgit.attributes.AttributesNodeProvider;
import org.eclipse.jgit.attributes.AttributesRule;
import org.eclipse.jgit.blame.BlameResult;
import org.eclipse.jgit.diff.*;
import org.eclipse.jgit.diff.Edit.Type;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.internal.storage.dfs.DfsRepository;
import org.eclipse.jgit.lib.*;
import org.eclipse.jgit.lib.RefUpdate.Result;
import org.eclipse.jgit.revwalk.RevCommit;
@@ -59,15 +63,13 @@ import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.io.NullOutputStream;
import org.tmatesoft.svn.core.SVNException;
import play.Logger;
import play.api.Play;
import play.libs.Json;
import utils.FileUtil;
import utils.GravatarUtil;

import javax.naming.LimitExceededException;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.*;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.*;
@@ -1110,7 +1112,7 @@ public class GitRepository implements PlayRepository {
diffFormatter.setDetectRenames(true);
return diffFormatter.scan(commitA, commitB);
} finally {
diffFormatter.release();
diffFormatter.close();
}
}

@@ -1148,7 +1150,7 @@ public class GitRepository implements PlayRepository {
.setStartCommit(start).call();
return getAuthorsFromBlameResult(edits, blameResult);
} finally {
diffFormatter.release();
diffFormatter.close();
}
}

@@ -1269,7 +1271,7 @@ public class GitRepository implements PlayRepository {
RevWalk revWalk = new RevWalk(fromRepo);
RevCommit commit = revWalk.parseCommit(fromRepo.resolve(branchName));
String commitName = commit.name(); // fromBranch's head commit name
revWalk.release();
revWalk.close();

// check whether the target repository has the commit witch is the fromBranch's head commit.
Repository toRepo = buildGitRepository(pullRequest.toProject);
@@ -1310,7 +1312,7 @@ public class GitRepository implements PlayRepository {
throw new RuntimeException(e);
} finally {
if(revWalk != null) {
revWalk.release();
revWalk.close();
}
if(repo != null) {
repo.close();
@@ -1506,6 +1508,11 @@ public class GitRepository implements PlayRepository {
}
return union;
}

@Override
public void close() {
play.Logger.warn("MultipleRepositoryObjectReader#close - Not implemented method but called!");
}
}

final MultipleRepositoryObjectReader reader = new MultipleRepositoryObjectReader();
@@ -1535,6 +1542,11 @@ public class GitRepository implements PlayRepository {
return repositoryA.getConfig();
}

@Override
public AttributesNodeProvider createAttributesNodeProvider() {
return new EmptyAttributesNodeProvider();
}

@Override
public void scanForRepoChanges() throws IOException {
throw new UnsupportedOperationException();
@@ -1553,6 +1565,32 @@ public class GitRepository implements PlayRepository {
public ObjectReader newObjectReader() {
return reader;
}

// Borrowed from org.eclipse.jgit.internal.storage.dfs.DfsRepository
class EmptyAttributesNodeProvider implements AttributesNodeProvider {
private EmptyAttributesNodeProvider.EmptyAttributesNode emptyAttributesNode
= new EmptyAttributesNodeProvider.EmptyAttributesNode();

public AttributesNode getInfoAttributesNode() throws IOException {
return emptyAttributesNode;
}

public AttributesNode getGlobalAttributesNode() throws IOException {
return emptyAttributesNode;
}

class EmptyAttributesNode extends AttributesNode {

public EmptyAttributesNode() {
super(Collections.<AttributesRule> emptyList());
}

@Override
public void parse(InputStream in) throws IOException {
// Do nothing
}
}
}
};

DiffFormatter formatter = new DiffFormatter(NullOutputStream.INSTANCE);
@@ -1791,7 +1829,7 @@ public class GitRepository implements PlayRepository {

@Override
public String getDefaultBranch() throws IOException {
return repository.getRef(Constants.HEAD).getTarget().getName();
return repository.findRef(Constants.HEAD).getTarget().getName();
}

@Override


+ 6
- 0
app/utils/diff_match_patch.java View File

@@ -1761,6 +1761,7 @@ public class diff_match_patch {
* @return LinkedList of Patch objects.
* @deprecated Prefer patch_make(String text1, LinkedList<Diff> diffs).
*/
@Deprecated
public LinkedList<Patch> patch_make(String text1, String text2,
LinkedList<Diff> diffs) {
return patch_make(text1, diffs);
@@ -2311,6 +2312,11 @@ public class diff_match_patch {
return false;
}
}

@Override
public int hashCode() {
return super.hashCode();
}
}




+ 9
- 6
build.sbt View File

@@ -16,13 +16,12 @@ libraryDependencies ++= Seq(
"com.h2database" % "h2" % "1.3.176",
// JDBC driver for mariadb
"org.mariadb.jdbc" % "mariadb-java-client" % "1.3.6",
"net.contentobjects.jnotify" % "jnotify" % "0.94",
// Core Library
"org.eclipse.jgit" % "org.eclipse.jgit" % "3.5.3.201412180710-r",
"org.eclipse.jgit" % "org.eclipse.jgit" % "4.5.0.201609210915-r",
// Smart HTTP Servlet
"org.eclipse.jgit" % "org.eclipse.jgit.http.server" % "3.5.3.201412180710-r",
// Symlink support for Java7
"org.eclipse.jgit" % "org.eclipse.jgit.java7" % "3.5.3.201412180710-r",
"org.eclipse.jgit" % "org.eclipse.jgit.http.server" % "4.5.0.201609210915-r",
// JGit Large File Storage
"org.eclipse.jgit" % "org.eclipse.jgit.lfs" % "4.5.0.201609210915-r",
// svnkit
"org.tmatesoft.svnkit" % "svnkit" % "1.8.12",
// svnkit-dav
@@ -54,7 +53,8 @@ libraryDependencies ++= Seq(

val projectSettings = Seq(
// Add your own project settings here
resolvers += "jgit-repository" at "http://download.eclipse.org/jgit/maven",
resolvers += "jgit-repository" at "https://repo.eclipse.org/content/groups/releases/",
resolvers += "java-semVer" at "http://oss.sonatype.org/content/repositories/snapshots/",
resolvers += "scm-manager release repository" at "http://maven.scm-manager.org/nexus/content/groups/public",
resolvers += "tmatesoft release repository" at "http://maven.tmatesoft.com/content/repositories/releases",
resolvers += "julienrf.github.com" at "http://julienrf.github.com/repo/",
@@ -124,3 +124,6 @@ lazy val yobi = (project in file("."))
</FindBugsFilter>
)
)


fork in run := true

+ 1
- 1
project/plugins.sbt View File

@@ -5,7 +5,7 @@ logLevel := Level.Warn
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.6")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.10")

// Dependency graph plugin
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")


Loading…
Cancel
Save