diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2016-02-15 23:27:28 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2016-02-15 23:28:18 +0100 |
commit | 514b11ddccc93cf21475cd3e61dde5d2ba8171f2 (patch) | |
tree | d8cf6e4de084facf58d667653003f10a798a5d60 /org.eclipse.jgit.pgm/src | |
parent | 621b0740b3acabe9cf25a054cc753f911cfba68a (diff) | |
parent | e9ce3a992ca5627cfa55aa0c5af7c42387c24709 (diff) | |
download | jgit-514b11ddccc93cf21475cd3e61dde5d2ba8171f2.tar.gz jgit-514b11ddccc93cf21475cd3e61dde5d2ba8171f2.zip |
Merge branch 'stable-4.2'
* stable-4.2:
Don't use deprecated LockFile constructor
Fix warnings about unchecked conversion of MergeResult
MockServletConfig: Fix warning about unchecked conversion of Enumeration
HugeFileTest: Make Git a class member and open in try-with-resource
Suppress "unchecked cast" warnings related to UploadPackFactory.DISABLED
DiffAlgorithms: Fix warnings about variable hiding
DirCacheBasicTest: Open ObjectInserter.Formatter in try-with-resource
DirCacheBuilderIteratorTest: Open TreeWalk in try-with-resource
DirCacheCGitCompatabilityTest: Open TreeWalk in try-with-resource
DirCacheCheckoutMaliciousPathTest: Open Git and RevWalk in t-w-r
DirCacheIteratorTest: Open TreeWalk instances in try-with-resource
ForPathTest: Open TreeWalk in try-with-resource
GitConstructionTest: Open Git instance in try-with-resource
IndexDiffTest: Open Git instances in try-with-resources
ManifestParserTest: Don't use deprecated StringBufferInputStream
InMemoryRepository: Remove unused RevWalk from batch method signature
IndexModificationTimesTest: Open Git instances in try-with-resource
InterIndexDiffFilterTest: Open TreeWalk in try-with-resource
LockFileTest: Open Git instance in try-with-resource
JGit v4.1.2.201602141800-r
MergeCommandTest: Use JUnit's assume to check preconditions
MergeCommandTest: Open Git instances in try-with-resource
Change-Id: Ie5dba6b9132a29e86958a04fa2b76465bcd2c6b5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm/src')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java | 23 | ||||
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java | 4 |
2 files changed, 14 insertions, 13 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java index c96f2c1ba4..05d094f0de 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java @@ -155,16 +155,16 @@ class DiffAlgorithms extends TextBuiltin { else rb.findGitDir(dir); - Repository db = rb.build(); + Repository repo = rb.build(); try { - run(db); + run(repo); } finally { - db.close(); + repo.close(); } } } - private void run(Repository db) throws Exception { + private void run(Repository repo) throws Exception { List<Test> all = init(); long files = 0; @@ -173,14 +173,14 @@ class DiffAlgorithms extends TextBuiltin { int maxN = 0; AbbreviatedObjectId startId; - try (ObjectReader or = db.newObjectReader(); + try (ObjectReader or = repo.newObjectReader(); RevWalk rw = new RevWalk(or)) { final MutableObjectId id = new MutableObjectId(); TreeWalk tw = new TreeWalk(or); tw.setFilter(TreeFilter.ANY_DIFF); tw.setRecursive(true); - ObjectId start = db.resolve(Constants.HEAD); + ObjectId start = repo.resolve(Constants.HEAD); startId = or.abbreviate(start); rw.markStart(rw.parseCommit(start)); for (;;) { @@ -235,14 +235,15 @@ class DiffAlgorithms extends TextBuiltin { Collections.sort(all, new Comparator<Test>() { public int compare(Test a, Test b) { - int cmp = Long.signum(a.runningTimeNanos - b.runningTimeNanos); - if (cmp == 0) - cmp = a.algorithm.name.compareTo(b.algorithm.name); - return cmp; + int result = Long.signum(a.runningTimeNanos - b.runningTimeNanos); + if (result == 0) { + result = a.algorithm.name.compareTo(b.algorithm.name); + } + return result; } }); - File directory = db.getDirectory(); + File directory = repo.getDirectory(); if (directory != null) { String name = directory.getName(); File parent = directory.getParentFile(); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java index e2f93f4814..8cfcba9113 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java @@ -235,7 +235,7 @@ class RebuildCommitGraph extends TextBuiltin { final ObjectId id = db.resolve(Constants.HEAD); if (!ObjectId.isId(head) && id != null) { final LockFile lf; - lf = new LockFile(new File(db.getDirectory(), Constants.HEAD), db.getFS()); + lf = new LockFile(new File(db.getDirectory(), Constants.HEAD)); if (!lf.lock()) throw new IOException(MessageFormat.format(CLIText.get().cannotLock, Constants.HEAD)); lf.write(id); @@ -263,7 +263,7 @@ class RebuildCommitGraph extends TextBuiltin { protected void writeFile(final String name, final byte[] content) throws IOException { final File file = new File(db.getDirectory(), name); - final LockFile lck = new LockFile(file, db.getFS()); + final LockFile lck = new LockFile(file); if (!lck.lock()) throw new ObjectWritingException(MessageFormat.format(CLIText.get().cantWrite, file)); try { |