Blame SOURCES/0001-Update-to-JGit-4.0.patch

65abda
From f7c05e9cd2e7cb72b16fb2a93ce699b58943443d Mon Sep 17 00:00:00 2001
65abda
From: Alexander Kurtakov <akurtako@redhat.com>
65abda
Date: Tue, 9 Jun 2015 19:17:30 +0300
65abda
Subject: [PATCH] Update to JGit 4.0
65abda
65abda
---
65abda
 pom.xml                                                   |  2 +-
65abda
 .../buildtimestamp/jgit/JGitBuildTimestampProvider.java   | 15 +++++++--------
65abda
 .../tycho/extras/buildtimestamp/jgit/PathFilter.java      | 10 +++++-----
65abda
 3 files changed, 13 insertions(+), 14 deletions(-)
65abda
65abda
diff --git a/pom.xml b/pom.xml
65abda
index c476294..717e6ee 100644
65abda
--- a/pom.xml
65abda
+++ b/pom.xml
65abda
@@ -74,7 +74,7 @@
65abda
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
65abda
 		<maven-version>3.0</maven-version>
65abda
 		<plugin-tools-version>3.3</plugin-tools-version>
65abda
-		<jgit-version>3.5.3.201412180710-r</jgit-version>
65abda
+		<jgit-version>4.0.0.201506020755-rc3</jgit-version>
65abda
 		
65abda
 		<tycho-version>${project.version}</tycho-version>
65abda
 		<min.jdk.version>1.7</min.jdk.version>
65abda
diff --git a/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java b/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java
65abda
index ae5b7fa..fb0d785 100644
65abda
--- a/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java
65abda
+++ b/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/JGitBuildTimestampProvider.java
65abda
@@ -152,12 +152,10 @@ public class JGitBuildTimestampProvider implements BuildTimestampProvider {
65abda
                             logger.warn("Fallback to default timestamp provider");
65abda
                             return defaultTimestampProvider.getTimestamp(session, project, execution);
65abda
                         } else {
65abda
-                            throw new MojoExecutionException(
65abda
-                                    message
65abda
-                                            + "\n"
65abda
-                                            + "You are trying to use tycho-buildtimestamp-jgit on a directory that has uncommitted changes (see details above)."
65abda
-                                            + "\nEither commit all changes/add files to .gitignore, or enable fallback to default timestamp provider by configuring "
65abda
-                                            + "\njgit.dirtyWorkingTree=warning for tycho-packaging-plugin");
65abda
+                            throw new MojoExecutionException(message + "\n"
65abda
+                                    + "You are trying to use tycho-buildtimestamp-jgit on a directory that has uncommitted changes (see details above)."
65abda
+                                    + "\nEither commit all changes/add files to .gitignore, or enable fallback to default timestamp provider by configuring "
65abda
+                                    + "\njgit.dirtyWorkingTree=warning for tycho-packaging-plugin");
65abda
                         }
65abda
                     }
65abda
                 }
65abda
@@ -172,12 +170,13 @@ public class JGitBuildTimestampProvider implements BuildTimestampProvider {
65abda
                     // When dirtyBehaviour==ignore and no commit was ever done, 
65abda
                     // the commit is null, so we fallback to the defaultTimestampProvider
65abda
                     if (commit == null) {
65abda
-                        logger.info("Fallback to default timestamp provider, because no commit could be found for that project (Shared but not commited yet).");
65abda
+                        logger.info(
65abda
+                                "Fallback to default timestamp provider, because no commit could be found for that project (Shared but not commited yet).");
65abda
                         return defaultTimestampProvider.getTimestamp(session, project, execution);
65abda
                     }
65abda
                     return new Date(commit.getCommitTime() * 1000L);
65abda
                 } finally {
65abda
-                    walk.release();
65abda
+                    walk.close();
65abda
                 }
65abda
             } finally {
65abda
                 repository.close();
65abda
diff --git a/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/PathFilter.java b/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/PathFilter.java
65abda
index ce349e9..96e6c51 100644
65abda
--- a/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/PathFilter.java
65abda
+++ b/tycho-buildtimestamp-jgit/src/main/java/org/eclipse/tycho/extras/buildtimestamp/jgit/PathFilter.java
65abda
@@ -18,7 +18,7 @@ import java.util.StringTokenizer;
65abda
 
65abda
 import org.eclipse.jgit.errors.IncorrectObjectTypeException;
65abda
 import org.eclipse.jgit.errors.MissingObjectException;
65abda
-import org.eclipse.jgit.ignore.IgnoreRule;
65abda
+import org.eclipse.jgit.ignore.FastIgnoreRule;
65abda
 import org.eclipse.jgit.lib.Constants;
65abda
 import org.eclipse.jgit.treewalk.TreeWalk;
65abda
 import org.eclipse.jgit.treewalk.filter.TreeFilter;
65abda
@@ -27,16 +27,16 @@ public class PathFilter extends TreeFilter {
65abda
 
65abda
     private final byte[] basedir;
65abda
 
65abda
-    private final List<IgnoreRule> rules;
65abda
+    private final List<FastIgnoreRule> rules;
65abda
 
65abda
     public PathFilter(String basedir, String filters) {
65abda
         this.basedir = Constants.encode(basedir);
65abda
 
65abda
         if (filters != null) {
65abda
             StringTokenizer st = new StringTokenizer(filters, "\n\r\f", false);
65abda
-            List<IgnoreRule> rules = new ArrayList<IgnoreRule>();
65abda
+            List<FastIgnoreRule> rules = new ArrayList<FastIgnoreRule>();
65abda
             while (st.hasMoreTokens()) {
65abda
-                rules.add(new IgnoreRule(st.nextToken().trim()));
65abda
+                rules.add(new FastIgnoreRule(st.nextToken().trim()));
65abda
             }
65abda
             this.rules = Collections.unmodifiableList(rules);
65abda
         } else {
65abda
@@ -53,7 +53,7 @@ public class PathFilter extends TreeFilter {
65abda
 
65abda
         if (!tw.isSubtree() && rules != null) {
65abda
             String path = tw.getPathString();
65abda
-            for (IgnoreRule rule : rules) {
65abda
+            for (FastIgnoreRule rule : rules) {
65abda
                 if (rule.isMatch(path, tw.isSubtree())) {
65abda
                     return !rule.getResult();
65abda
                 }
65abda
-- 
65abda
2.4.2
65abda