Merge changes Id9a641dd,If2ee1f42
* changes:
Added TestCase for 7d5e1f Fixed RevWalk.isMergedInto()
Fixed RevWalk.isMergedInto() returning wrong results
diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ClientVersionUtil.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ClientVersionUtil.java
index b64e349..c0d4b5e 100644
--- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ClientVersionUtil.java
+++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/ClientVersionUtil.java
@@ -131,7 +131,7 @@
* first parsed version string.
* @param b
* second parsed version string.
- * @return <0 if a is before b; 0 if a equals b; >0 if a is after b.
+ * @return < 0 if a is before b; 0 if a equals b; >0 if a is after b.
*/
public static int compare(int[] a, int[] b) {
for (int i = 0; i < a.length && i < b.length; i++) {
diff --git "a/org.eclipse.jgit.java7.test/org.eclipse.jgit.java7 -- Java7 feature test \050Java 8\051.launch" "b/org.eclipse.jgit.java7.test/org.eclipse.jgit.java7 -- Java7 feature test \050Java 8\051.launch"
new file mode 100644
index 0000000..0c460f0
--- /dev/null
+++ "b/org.eclipse.jgit.java7.test/org.eclipse.jgit.java7 -- Java7 feature test \050Java 8\051.launch"
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.jgit.java7.test"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.jgit.java7.test"/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.jgit.java7.test"/>
+</launchConfiguration>
diff --git "a/org.eclipse.jgit.pgm.test/org.eclipse.jgit.pgm--All-Tests \050Java8\051.launch" "b/org.eclipse.jgit.pgm.test/org.eclipse.jgit.pgm--All-Tests \050Java8\051.launch"
new file mode 100644
index 0000000..1b61d3d
--- /dev/null
+++ "b/org.eclipse.jgit.pgm.test/org.eclipse.jgit.pgm--All-Tests \050Java8\051.launch"
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.jgit.pgm.test/tst"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="2"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.jgit.pgm.test/tst"/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="org.eclipse.jgit.pgm.test"/> </runtimeClasspathEntry> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry path="3" projectName="org.eclipse.jgit.java7" type="1"/> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.jgit.pgm.test"/>
+</launchConfiguration>
diff --git a/org.eclipse.jgit.pgm.test/pom.xml b/org.eclipse.jgit.pgm.test/pom.xml
index 24230ba..830f512 100644
--- a/org.eclipse.jgit.pgm.test/pom.xml
+++ b/org.eclipse.jgit.pgm.test/pom.xml
@@ -64,7 +64,7 @@
<profile>
<id>jgit.java7</id>
<activation>
- <jdk>1.7</jdk>
+ <jdk>[1.7,)</jdk>
</activation>
<dependencies>
<dependency>
diff --git a/org.eclipse.jgit.pgm/pom.xml b/org.eclipse.jgit.pgm/pom.xml
index b2d4262..8ef89ce 100644
--- a/org.eclipse.jgit.pgm/pom.xml
+++ b/org.eclipse.jgit.pgm/pom.xml
@@ -112,7 +112,7 @@
<profile>
<id>java7</id>
<activation>
- <jdk>1.7</jdk>
+ <jdk>[1.7,)</jdk>
</activation>
<dependencies>
<dependency>
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java
index 1fe39da..d226df2 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java
@@ -50,7 +50,6 @@
import static java.lang.Character.valueOf;
import java.io.IOException;
-import java.io.PrintWriter;
import java.text.MessageFormat;
import org.eclipse.jgit.lib.Constants;
@@ -60,6 +59,7 @@
import org.eclipse.jgit.pgm.internal.CLIText;
import org.eclipse.jgit.transport.FetchResult;
import org.eclipse.jgit.transport.TrackingRefUpdate;
+import org.eclipse.jgit.util.io.ThrowingPrintWriter;
import org.kohsuke.args4j.Option;
abstract class AbstractFetchCommand extends TextBuiltin {
@@ -92,11 +92,10 @@
} finally {
reader.release();
}
- showRemoteMessages(r.getMessages());
+ showRemoteMessages(errw, r.getMessages());
}
- static void showRemoteMessages(String pkt) {
- PrintWriter writer = new PrintWriter(System.err);
+ static void showRemoteMessages(ThrowingPrintWriter writer, String pkt) throws IOException {
while (0 < pkt.length()) {
final int lf = pkt.indexOf('\n');
final int cr = pkt.indexOf('\r');
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java
index 5e66c36..e0a9244 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java
@@ -116,7 +116,7 @@
final OutputStream os = s3.beginPut(bucket, key, null, null);
final byte[] tmp = new byte[2048];
int n;
- while ((n = System.in.read(tmp)) > 0)
+ while ((n = ins.read(tmp)) > 0)
os.write(tmp, 0, n);
os.close();
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Die.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Die.java
index a2f4060..f07df1a 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Die.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Die.java
@@ -54,6 +54,8 @@
public class Die extends RuntimeException {
private static final long serialVersionUID = 1L;
+ private boolean aborted;
+
/**
* Construct a new message explaining what has gone wrong.
*
@@ -75,4 +77,25 @@
public Die(final String why, final Throwable cause) {
super(why, cause);
}
+
+ /**
+ * Construct a new exception reflecting the fact that the
+ * command execution has been aborted before running.
+ *
+ * @param aborted boolean indicating the fact the execution has been aborted
+ * @since 3.4
+ */
+ public Die(boolean aborted) {
+ this.aborted = aborted;
+ }
+
+ /**
+ * Check if this exception should cause the execution to be aborted.
+ *
+ * @return boolean indicating that the execution should be aborted
+ * @since 3.4
+ */
+ public boolean isAborted() {
+ return aborted;
+ }
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/IndexPack.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/IndexPack.java
index 9fc5882..4211406 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/IndexPack.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/IndexPack.java
@@ -62,7 +62,7 @@
@Override
protected void run() throws Exception {
- BufferedInputStream in = new BufferedInputStream(System.in);
+ BufferedInputStream in = new BufferedInputStream(ins);
ObjectInserter inserter = db.newObjectInserter();
try {
PackParser p = inserter.newPackParser(in);
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
index 3648ffd..9459139 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
@@ -123,6 +123,8 @@
configureHttpProxy();
execute(argv);
} catch (Die err) {
+ if (err.isAborted())
+ System.exit(1);
System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage()));
if (showStackTrace)
err.printStackTrace();
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java
index b252de8..c7c27b4 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java
@@ -161,7 +161,7 @@
printRefUpdateResult(reader, uri, result, rru);
}
- AbstractFetchCommand.showRemoteMessages(result.getMessages());
+ AbstractFetchCommand.showRemoteMessages(errw, result.getMessages());
if (everythingUpToDate)
outw.println(CLIText.get().everythingUpToDate);
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java
index bc8f497..d7f895a 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/ReceivePack.java
@@ -76,6 +76,6 @@
}
rp = new org.eclipse.jgit.transport.ReceivePack(db);
- rp.receive(System.in, outs, System.err);
+ rp.receive(ins, outs, errs);
}
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java
index 847bf7f..e23fb35 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java
@@ -199,10 +199,9 @@
final int n = walkLoop();
if (count) {
final long end = System.currentTimeMillis();
- System.err.print(n);
- System.err.print(' ');
- System.err
- .println(MessageFormat.format(
+ errw.print(n);
+ errw.print(' ');
+ errw.println(MessageFormat.format(
CLIText.get().timeInMilliSeconds,
Long.valueOf(end - start)));
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java
index 7f7ef8d..8e8b82f 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/TextBuiltin.java
@@ -50,8 +50,10 @@
import java.io.BufferedWriter;
import java.io.FileDescriptor;
+import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
@@ -85,6 +87,13 @@
private boolean help;
/**
+ * Input stream, typically this is standard input.
+ *
+ * @since 3.4
+ */
+ protected InputStream ins;
+
+ /**
* Writer to output to, typically this is standard output.
*
* @since 2.2
@@ -106,6 +115,20 @@
@Deprecated
protected PrintWriter out;
+ /**
+ * Error writer, typically this is standard error.
+ *
+ * @since 3.4
+ */
+ protected ThrowingPrintWriter errw;
+
+ /**
+ * Error output stream, typically this is standard error.
+ *
+ * @since 3.4
+ */
+ protected OutputStream errs;
+
/** Git repository the command was invoked within. */
protected Repository db;
@@ -137,16 +160,27 @@
try {
final String outputEncoding = repository != null ? repository
.getConfig().getString("i18n", null, "logOutputEncoding") : null; //$NON-NLS-1$ //$NON-NLS-2$
+ if (ins == null)
+ ins = new FileInputStream(FileDescriptor.in);
if (outs == null)
outs = new FileOutputStream(FileDescriptor.out);
- BufferedWriter bufw;
+ if (errs == null)
+ errs = new FileOutputStream(FileDescriptor.err);
+ BufferedWriter outbufw;
if (outputEncoding != null)
- bufw = new BufferedWriter(new OutputStreamWriter(outs,
+ outbufw = new BufferedWriter(new OutputStreamWriter(outs,
outputEncoding));
else
- bufw = new BufferedWriter(new OutputStreamWriter(outs));
- out = new PrintWriter(bufw);
- outw = new ThrowingPrintWriter(bufw);
+ outbufw = new BufferedWriter(new OutputStreamWriter(outs));
+ out = new PrintWriter(outbufw);
+ outw = new ThrowingPrintWriter(outbufw);
+ BufferedWriter errbufw;
+ if (outputEncoding != null)
+ errbufw = new BufferedWriter(new OutputStreamWriter(errs,
+ outputEncoding));
+ else
+ errbufw = new BufferedWriter(new OutputStreamWriter(errs));
+ errw = new ThrowingPrintWriter(errbufw);
} catch (IOException e) {
throw die(CLIText.get().cannotCreateOutputStream);
}
@@ -184,15 +218,16 @@
*
* @param args
* the arguments supplied on the command line, if any.
+ * @throws IOException
*/
- protected void parseArguments(final String[] args) {
+ protected void parseArguments(final String[] args) throws IOException {
final CmdLineParser clp = new CmdLineParser(this);
try {
clp.parseArgument(args);
} catch (CmdLineException err) {
if (!help) {
- System.err.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage()));
- System.exit(1);
+ this.errw.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage()));
+ throw die(true);
}
}
@@ -207,8 +242,9 @@
* Print the usage line
*
* @param clp
+ * @throws IOException
*/
- public void printUsageAndExit(final CmdLineParser clp) {
+ public void printUsageAndExit(final CmdLineParser clp) throws IOException {
printUsageAndExit("", clp); //$NON-NLS-1$
}
@@ -217,21 +253,21 @@
*
* @param message
* @param clp
+ * @throws IOException
*/
- public void printUsageAndExit(final String message, final CmdLineParser clp) {
- PrintWriter writer = new PrintWriter(System.err);
- writer.println(message);
- writer.print("jgit "); //$NON-NLS-1$
- writer.print(commandName);
- clp.printSingleLineUsage(writer, getResourceBundle());
- writer.println();
+ public void printUsageAndExit(final String message, final CmdLineParser clp) throws IOException {
+ errw.println(message);
+ errw.print("jgit "); //$NON-NLS-1$
+ errw.print(commandName);
+ clp.printSingleLineUsage(errw, getResourceBundle());
+ errw.println();
- writer.println();
- clp.printUsage(writer, getResourceBundle());
- writer.println();
+ errw.println();
+ clp.printUsage(errw, getResourceBundle());
+ errw.println();
- writer.flush();
- System.exit(1);
+ errw.flush();
+ throw die(true);
}
/**
@@ -288,6 +324,16 @@
return new Die(why, cause);
}
+ /**
+ * @param aborted
+ * boolean indicating that the execution has been aborted before running
+ * @return a runtime exception the caller is expected to throw
+ * @since 3.4
+ */
+ protected static Die die(boolean aborted) {
+ return new Die(aborted);
+ }
+
String abbreviateRef(String dst, boolean abbreviateRemote) {
if (dst.startsWith(R_HEADS))
dst = dst.substring(R_HEADS.length());
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java
index 4ace0aa..447374d 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/UploadPack.java
@@ -82,6 +82,6 @@
up = new org.eclipse.jgit.transport.UploadPack(db);
if (0 <= timeout)
up.setTimeout(timeout);
- up.upload(System.in, outs, System.err);
+ up.upload(ins, outs, errs);
}
}
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 cd0236c..2140939 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
@@ -117,7 +117,7 @@
@Override
protected void run() throws Exception {
if (!really && !db.getRefDatabase().getRefs(ALL).isEmpty()) {
- System.err.println(
+ errw.println(
MessageFormat.format(CLIText.get().fatalThisProgramWillDestroyTheRepository
, db.getDirectory().getAbsolutePath(), REALLY));
throw die(CLIText.get().needApprovalToDestroyCurrentRepository);
@@ -294,7 +294,7 @@
rw.parseAny(id);
} catch (MissingObjectException mue) {
if (!Constants.TYPE_COMMIT.equals(type)) {
- System.err.println(MessageFormat.format(CLIText.get().skippingObject, type, name));
+ errw.println(MessageFormat.format(CLIText.get().skippingObject, type, name));
continue;
}
throw new MissingObjectException(id, type);
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java
index 4f6d150..aa25807 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCommands.java
@@ -43,14 +43,16 @@
package org.eclipse.jgit.pgm.debug;
+import java.io.IOException;
import java.net.URL;
-import org.kohsuke.args4j.Option;
import org.eclipse.jgit.pgm.Command;
import org.eclipse.jgit.pgm.CommandCatalog;
import org.eclipse.jgit.pgm.CommandRef;
import org.eclipse.jgit.pgm.TextBuiltin;
import org.eclipse.jgit.pgm.internal.CLIText;
+import org.eclipse.jgit.util.io.ThrowingPrintWriter;
+import org.kohsuke.args4j.Option;
@Command(usage = "usage_displayAListOfAllRegisteredJgitCommands")
class ShowCommands extends TextBuiltin {
@@ -67,39 +69,39 @@
width += 2;
for (final CommandRef c : list) {
- System.err.print(c.isCommon() ? '*' : ' ');
- System.err.print(' ');
+ errw.print(c.isCommon() ? '*' : ' ');
+ errw.print(' ');
- System.err.print(c.getName());
+ errw.print(c.getName());
for (int i = c.getName().length(); i < width; i++)
- System.err.print(' ');
+ errw.print(' ');
- pretty.print(c);
- System.err.println();
+ pretty.print(errw, c);
+ errw.println();
}
- System.err.println();
+ errw.println();
}
static enum Format {
/** */
USAGE {
- void print(final CommandRef c) {
+ void print(ThrowingPrintWriter err, final CommandRef c) throws IOException {
String usage = c.getUsage();
if (usage != null && usage.length() > 0)
- System.err.print(CLIText.get().resourceBundle().getString(usage));
+ err.print(CLIText.get().resourceBundle().getString(usage));
}
},
/** */
CLASSES {
- void print(final CommandRef c) {
- System.err.print(c.getImplementationClassName());
+ void print(ThrowingPrintWriter err, final CommandRef c) throws IOException {
+ err.print(c.getImplementationClassName());
}
},
/** */
URLS {
- void print(final CommandRef c) {
+ void print(ThrowingPrintWriter err, final CommandRef c) throws IOException {
final ClassLoader ldr = c.getImplementationClassLoader();
String cn = c.getImplementationClassName();
@@ -107,7 +109,7 @@
final URL url = ldr.getResource(cn);
if (url == null) {
- System.err.print(CLIText.get().notFound);
+ err.print(CLIText.get().notFound);
return;
}
@@ -115,10 +117,10 @@
if (rn.endsWith(cn))
rn = rn.substring(0, rn.length() - cn.length());
- System.err.print(rn);
+ err.print(rn);
}
};
- abstract void print(CommandRef c);
+ abstract void print(ThrowingPrintWriter err, CommandRef c) throws IOException;
}
}
diff --git "a/org.eclipse.jgit.test/org.eclipse.jgit.core--All-Tests \050Java 8\051.launch" "b/org.eclipse.jgit.test/org.eclipse.jgit.core--All-Tests \050Java 8\051.launch"
new file mode 100644
index 0000000..04aa3ea
--- /dev/null
+++ "b/org.eclipse.jgit.test/org.eclipse.jgit.core--All-Tests \050Java 8\051.launch"
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/org.eclipse.jgit.test/tst"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="2"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.jgit.test/tst"/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
+<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
+<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6" path="1" type="4"/> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="org.eclipse.jgit.test"/> </runtimeClasspathEntry> "/>
+<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry path="3" projectName="org.eclipse.jgit.java7" type="1"/> "/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.jgit.test"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx256m"/>
+</launchConfiguration>
diff --git a/org.eclipse.jgit.test/pom.xml b/org.eclipse.jgit.test/pom.xml
index 47e47b4..5e011f9 100644
--- a/org.eclipse.jgit.test/pom.xml
+++ b/org.eclipse.jgit.test/pom.xml
@@ -66,7 +66,7 @@
<profile>
<id>jgit.java7</id>
<activation>
- <jdk>1.7</jdk>
+ <jdk>[1.7,)</jdk>
</activation>
<dependencies>
<dependency>
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/NameRevCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/NameRevCommandTest.java
index b92a636..4915954 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/NameRevCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/NameRevCommandTest.java
@@ -44,6 +44,7 @@
package org.eclipse.jgit.api;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.util.Map;
@@ -109,6 +110,19 @@
}
@Test
+ public void annotatedTagsNoResult() throws Exception {
+ RevCommit c = tr.commit().create();
+ tr.update("refs/heads/master", c);
+ tr.update("refs/tags/tag1", c);
+ tr.update("refs/tags/tag2", c);
+ Map<ObjectId, String> result = git.nameRev()
+ .add(c)
+ .addAnnotatedTags()
+ .call();
+ assertTrue(result.toString(), result.isEmpty());
+ }
+
+ @Test
public void simpleAncestor() throws Exception {
// 0--1--2
RevCommit c0 = tr.commit().create();
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java
index 40eb494..c5829ec 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java
@@ -2347,7 +2347,7 @@
assertFalse(messageFixupFile.exists());
assertTrue(messageSquashFile.exists());
assertEquals(
- "# This is a combination of 2 commits.\n# This is the 2nd commit message:\nupdated file1 on master\nnew line\n# The first commit's message is:\nAdd file2\nnew line",
+ "# This is a combination of 2 commits.\n# The first commit's message is:\nAdd file2\nnew line\n# This is the 2nd commit message:\nupdated file1 on master\nnew line",
commit);
try {
@@ -2426,7 +2426,7 @@
assertFalse(messageFixupFile.exists());
assertTrue(messageSquashFile.exists());
assertEquals(
- "# This is a combination of 3 commits.\n# This is the 3rd commit message:\nupdated file1 on master\nnew line\n# This is the 2nd commit message:\nAdd file2\nnew line\n# The first commit's message is:\nAdd file1\nnew line",
+ "# This is a combination of 3 commits.\n# The first commit's message is:\nAdd file1\nnew line\n# This is the 2nd commit message:\nAdd file2\nnew line\n# This is the 3rd commit message:\nupdated file1 on master\nnew line",
commit);
try {
@@ -2441,7 +2441,7 @@
fail(t.getMessage());
}
- return "# This is a combination of 3 commits.\n# This is the 3rd commit message:\nupdated file1 on master\nnew line\n# This is the 2nd commit message:\nAdd file2\nnew line\n# The first commit's message is:\nAdd file1\nnew line";
+ return "# This is a combination of 3 commits.\n# The first commit's message is:\nAdd file1\nnew line\n# This is the 2nd commit message:\nAdd file2\nnew line\n# This is the 3rd commit message:\nupdated file1 on master\nnew line";
}
}).call();
@@ -2454,7 +2454,7 @@
ObjectId head2Id = db.resolve(Constants.HEAD + "^1");
RevCommit head1Commit = walk.parseCommit(head2Id);
assertEquals(
- "updated file1 on master\nnew line\nAdd file2\nnew line\nAdd file1\nnew line",
+ "Add file1\nnew line\nAdd file2\nnew line\nupdated file1 on master\nnew line",
head1Commit.getFullMessage());
}
@@ -2508,7 +2508,7 @@
assertFalse(messageFixupFile.exists());
assertTrue(messageSquashFile.exists());
assertEquals(
- "# This is a combination of 3 commits.\n# This is the 3rd commit message:\nupdated file1 on master\nnew line\n# The 2nd commit message will be skipped:\n# Add file2\n# new line\n# The first commit's message is:\nAdd file1\nnew line",
+ "# This is a combination of 3 commits.\n# The first commit's message is:\nAdd file1\nnew line\n# The 2nd commit message will be skipped:\n# Add file2\n# new line\n# This is the 3rd commit message:\nupdated file1 on master\nnew line",
commit);
try {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPackRefsTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPackRefsTest.java
index 0ade902..c7336da 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPackRefsTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcPackRefsTest.java
@@ -45,6 +45,7 @@
import static java.lang.Integer.valueOf;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import java.io.File;
@@ -57,10 +58,16 @@
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
+import org.eclipse.jgit.api.Git;
+import org.eclipse.jgit.junit.TestRepository.BranchBuilder;
+import org.eclipse.jgit.lib.ConfigConstants;
+import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Ref.Storage;
import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.RefUpdate.Result;
import org.eclipse.jgit.revwalk.RevBlob;
+import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.junit.Test;
public class GcPackRefsTest extends GcTestCase {
@@ -177,4 +184,65 @@
assertEquals(repo.getRef("refs/tags/t").getObjectId(), b);
}
+
+ @Test
+ public void dontPackHEAD_nonBare() throws Exception {
+ BranchBuilder bb = tr.branch("refs/heads/side");
+ RevCommit first = bb.commit().add("A", "A").add("B", "B").create();
+ bb.commit().add("A", "A2").add("B", "B2").create();
+ Git git = Git.wrap(repo);
+
+ // check for the unborn branch master. HEAD should point to master and
+ // master doesn't exist.
+ assertEquals(repo.getRef("HEAD").getTarget().getName(),
+ "refs/heads/master");
+ assertNull(repo.getRef("HEAD").getTarget().getObjectId());
+ gc.packRefs();
+ assertSame(repo.getRef("HEAD").getStorage(), Storage.LOOSE);
+ assertEquals(repo.getRef("HEAD").getTarget().getName(),
+ "refs/heads/master");
+ assertNull(repo.getRef("HEAD").getTarget().getObjectId());
+
+ git.checkout().setName("refs/heads/side").call();
+ gc.packRefs();
+ assertSame(repo.getRef("HEAD").getStorage(), Storage.LOOSE);
+
+ // check for detached HEAD
+ git.checkout().setName(first.getName()).call();
+ gc.packRefs();
+ assertSame(repo.getRef("HEAD").getStorage(), Storage.LOOSE);
+ }
+
+ @Test
+ public void dontPackHEAD_bare() throws Exception {
+ BranchBuilder bb = tr.branch("refs/heads/side");
+ bb.commit().add("A", "A").add("B", "B").create();
+ RevCommit second = bb.commit().add("A", "A2").add("B", "B2").create();
+
+ // Convert the repo to be bare
+ FileBasedConfig cfg = repo.getConfig();
+ cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
+ ConfigConstants.CONFIG_KEY_BARE, true);
+ cfg.save();
+ Git git = Git.open(repo.getDirectory());
+ repo = (FileRepository) git.getRepository();
+
+ // check for the unborn branch master. HEAD should point to master and
+ // master doesn't exist.
+ assertEquals(repo.getRef("HEAD").getTarget().getName(),
+ "refs/heads/master");
+ assertNull(repo.getRef("HEAD").getTarget().getObjectId());
+ gc.packRefs();
+ assertSame(repo.getRef("HEAD").getStorage(), Storage.LOOSE);
+ assertEquals(repo.getRef("HEAD").getTarget().getName(),
+ "refs/heads/master");
+ assertNull(repo.getRef("HEAD").getTarget().getObjectId());
+
+ // check for non-detached HEAD
+ repo.updateRef(Constants.HEAD).link("refs/heads/side");
+ gc.packRefs();
+ assertSame(repo.getRef("HEAD").getStorage(), Storage.LOOSE);
+ assertEquals(repo.getRef("HEAD").getTarget().getObjectId(),
+ second.getId());
+ }
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java
index 3f58b75..9fc7fca 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectCheckerTest.java
@@ -1493,8 +1493,8 @@
}
StringBuilder b = new StringBuilder();
- entry(b, "100644 \u00C1");
- entry(b, "100644 \u004a\u0301");
+ entry(b, "100644 \u0065\u0301");
+ entry(b, "100644 \u00e9");
byte[] data = b.toString().getBytes("UTF-8");
try {
checker.setSafeForMacOS(true);
@@ -1506,6 +1506,15 @@
}
@Test
+ public void testInvalidTreeDuplicateNames8()
+ throws UnsupportedEncodingException, CorruptObjectException {
+ StringBuilder b = new StringBuilder();
+ entry(b, "100644 A");
+ checker.setSafeForMacOS(true);
+ checker.checkTree(b.toString().getBytes("UTF-8"));
+ }
+
+ @Test
public void testRejectNulInPathSegment() {
try {
checker.checkPathSegment(Constants.encodeASCII("a\u0000b"), 0, 3);
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ValidRefNameTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ValidRefNameTest.java
index 2f8bfb3..e9d46bb 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ValidRefNameTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ValidRefNameTest.java
@@ -51,7 +51,47 @@
public class ValidRefNameTest {
private static void assertValid(final boolean exp, final String name) {
- assertEquals("\"" + name + "\"", exp, Repository.isValidRefName(name));
+ SystemReader instance = SystemReader.getInstance();
+ try {
+ setUnixSystemReader();
+ assertEquals("\"" + name + "\"", exp,
+ Repository.isValidRefName(name));
+ setWindowsSystemReader();
+ assertEquals("\"" + name + "\"", exp,
+ Repository.isValidRefName(name));
+ } finally {
+ SystemReader.setInstance(instance);
+ }
+ }
+
+ private static void setWindowsSystemReader() {
+ SystemReader.setInstance(new MockSystemReader() {
+ {
+ setWindows();
+ }
+ });
+ }
+
+ private static void setUnixSystemReader() {
+ SystemReader.setInstance(new MockSystemReader() {
+ {
+ setUnix();
+ }
+ });
+ }
+
+ private static void assertInvalidOnWindows(final String name) {
+ SystemReader instance = SystemReader.getInstance();
+ try {
+ setUnixSystemReader();
+ assertEquals("\"" + name + "\"", true,
+ Repository.isValidRefName(name));
+ setWindowsSystemReader();
+ assertEquals("\"" + name + "\"", false,
+ Repository.isValidRefName(name));
+ } finally {
+ SystemReader.setInstance(instance);
+ }
}
@Test
@@ -153,9 +193,8 @@
}
@Test
- public void testValidSpecialCharacters() {
+ public void testValidSpecialCharacterUnixs() {
assertValid(true, "refs/heads/!");
- assertValid(true, "refs/heads/\"");
assertValid(true, "refs/heads/#");
assertValid(true, "refs/heads/$");
assertValid(true, "refs/heads/%");
@@ -167,21 +206,24 @@
assertValid(true, "refs/heads/,");
assertValid(true, "refs/heads/-");
assertValid(true, "refs/heads/;");
- assertValid(true, "refs/heads/<");
assertValid(true, "refs/heads/=");
- assertValid(true, "refs/heads/>");
assertValid(true, "refs/heads/@");
assertValid(true, "refs/heads/]");
assertValid(true, "refs/heads/_");
assertValid(true, "refs/heads/`");
assertValid(true, "refs/heads/{");
- assertValid(true, "refs/heads/|");
assertValid(true, "refs/heads/}");
// This is valid on UNIX, but not on Windows
// hence we make in invalid due to non-portability
//
assertValid(false, "refs/heads/\\");
+
+ // More invalid characters on Windows, but we allow them
+ assertInvalidOnWindows("refs/heads/\"");
+ assertInvalidOnWindows("refs/heads/<");
+ assertInvalidOnWindows("refs/heads/>");
+ assertInvalidOnWindows("refs/heads/|");
}
@Test
@@ -197,22 +239,12 @@
@Test
public void testWindowsReservedNames() {
- SystemReader original = SystemReader.getInstance();
- try {
- SystemReader.setInstance(new MockSystemReader() {
- public boolean isWindows() {
- return true;
- }
- });
- // re-using code from DirCacheCheckoutTest, hence
- // only testing for one of the special names.
- assertValid(false, "refs/heads/con");
- assertValid(false, "refs/con/x");
- assertValid(false, "con/heads/x");
- assertValid(true, "refs/heads/conx");
- assertValid(true, "refs/heads/xcon");
- } finally {
- SystemReader.setInstance(original);
- }
+ // re-using code from DirCacheCheckoutTest, hence
+ // only testing for one of the special names.
+ assertInvalidOnWindows("refs/heads/con");
+ assertInvalidOnWindows("refs/con/x");
+ assertInvalidOnWindows("con/heads/x");
+ assertValid(true, "refs/heads/conx");
+ assertValid(true, "refs/heads/xcon");
}
}
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
index 34ea584..51110b1 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java
@@ -277,6 +277,11 @@
git.add().addFilepattern("file").call();
writeTrashFile("file", "conten2");
f.setLastModified(lastModified);
+ // We cannot trust this to go fast enough on
+ // a system with less than one-second lastModified
+ // resolution, so we force the index to have the
+ // same timestamp as the file we look at.
+ db.getIndexFile().setLastModified(lastModified);
DirCacheEntry dce = db.readDirCache().getEntry("file");
FileTreeIterator fti = new FileTreeIterator(trash, db.getFS(), db
.getConfig().get(WorkingTreeOptions.KEY));
diff --git a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java
index 0752dce..4d32235 100644
--- a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java
+++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java
@@ -74,7 +74,7 @@
* <li>Commit graph and short message</li>
* <li>Author name and email address</li>
* <li>Author date and time</li>
- * </ul>
+ * </ol>
*/
public class CommitGraphPane extends JTable {
private static final long serialVersionUID = 1L;
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
index 57c08f3..3bc682b 100644
--- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
+++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
@@ -266,7 +266,7 @@
invalidLineInConfigFile=Invalid line in config file
invalidModeFor=Invalid mode {0} for {1} {2} in {3}.
invalidModeForPath=Invalid mode {0} for path {1}
-invalidObject=Invalid {0} {1}:{2}
+invalidObject=Invalid {0} {1}: {2}
invalidOldIdSent=invalid old id sent
invalidPacketLineHeader=Invalid packet line header: {0}
invalidPath=Invalid path: {0}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DescribeCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DescribeCommand.java
index 6feb186..2ca8422 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DescribeCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DescribeCommand.java
@@ -142,7 +142,7 @@
* @return if there's a tag that points to the commit being described, this
* tag name is returned. Otherwise additional suffix is added to the
* nearest tag, just like git-describe(1).
- * <p/>
+ * <p>
* If none of the ancestors of the commit being described has any
* tags at all, then this method returns null, indicating that
* there's no way to describe this tag.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
index d8e73e3..6f0313d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
@@ -107,7 +107,7 @@
/**
* The modes available for fast forward merges corresponding to the
* <code>--ff</code>, <code>--no-ff</code> and <code>--ff-only</code>
- * options under <code>branch.<name>.mergeoptions</code>.
+ * options under <code>branch.<name>.mergeoptions</code>.
*/
public enum FastForwardMode implements ConfigEnum {
/**
@@ -162,7 +162,7 @@
*
* @param ffMode
* the <code>FastForwardMode</code> value to be mapped
- * @return the mapped code>FastForwardMode.Merge</code> value
+ * @return the mapped <code>FastForwardMode.Merge</code> value
*/
public static Merge valueOf(FastForwardMode ffMode) {
switch (ffMode) {
@@ -182,7 +182,7 @@
*
* @param ffMode
* the <code>FastForwardMode.Merge</code> value to be mapped
- * @return the mapped code>FastForwardMode</code> value
+ * @return the mapped <code>FastForwardMode</code> value
*/
public static FastForwardMode valueOf(FastForwardMode.Merge ffMode) {
switch (ffMode) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java
index 30edf96..2def12f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java
@@ -464,32 +464,36 @@
* file to a two-dimensional int-array of line-numbers telling where in the
* file conflict markers for which merged commit can be found.
* <p>
- * If the returned value contains a mapping "path"->[x][y]=z then this means
+ * If the returned value contains a mapping "path"->[x][y]=z then this
+ * means
* <ul>
* <li>the file with path "path" contains conflicts</li>
- * <li>if y < "number of merged commits": for conflict number x in this file
- * the chunk which was copied from commit number y starts on line number z.
- * All numberings and line numbers start with 0.</li>
+ * <li>if y < "number of merged commits": for conflict number x in this
+ * file the chunk which was copied from commit number y starts on line
+ * number z. All numberings and line numbers start with 0.</li>
* <li>if y == "number of merged commits": the first non-conflicting line
* after conflict number x starts at line number z</li>
* </ul>
* <p>
* Example code how to parse this data:
- * <pre> MergeResult m=...;
- * Map<String, int[][]> allConflicts = m.getConflicts();
+ *
+ * <pre>
+ * MergeResult m=...;
+ * Map<String, int[][]> allConflicts = m.getConflicts();
* for (String path : allConflicts.keySet()) {
* int[][] c = allConflicts.get(path);
* System.out.println("Conflicts in file " + path);
* for (int i = 0; i < c.length; ++i) {
* System.out.println(" Conflict #" + i);
- * for (int j = 0; j < (c[i].length) - 1; ++j) {
+ * for (int j = 0; j < (c[i].length) - 1; ++j) {
* if (c[i][j] >= 0)
* System.out.println(" Chunk for "
* + m.getMergedCommits()[j] + " starts on line #"
* + c[i][j]);
* }
* }
- * }</pre>
+ * }
+ * </pre>
*
* @return the conflicts or <code>null</code> if no conflict occurred
*/
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/NameRevCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/NameRevCommand.java
index 95a1f35..cce42fc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/NameRevCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/NameRevCommand.java
@@ -112,8 +112,8 @@
private final RevWalk walk;
private final List<String> prefixes;
- private final List<Ref> refs;
private final List<ObjectId> revs;
+ private List<Ref> refs;
private int mergeCost;
/**
@@ -125,7 +125,6 @@
super(repo);
mergeCost = MERGE_COST;
prefixes = new ArrayList<String>(2);
- refs = new ArrayList<Ref>();
revs = new ArrayList<ObjectId>(2);
walk = new RevWalk(repo) {
@Override
@@ -140,8 +139,10 @@
try {
Map<ObjectId, String> nonCommits = new HashMap<ObjectId, String>();
FIFORevQueue pending = new FIFORevQueue();
- for (Ref ref : refs)
- addRef(ref, nonCommits, pending);
+ if (refs != null) {
+ for (Ref ref : refs)
+ addRef(ref, nonCommits, pending);
+ }
addPrefixes(nonCommits, pending);
int cutoff = minCommitTime() - COMMIT_TIME_SLOP;
@@ -273,6 +274,8 @@
*/
public NameRevCommand addAnnotatedTags() {
checkCallable();
+ if (refs == null)
+ refs = new ArrayList<Ref>();
try {
for (Ref ref : repo.getRefDatabase().getRefs(Constants.R_TAGS).values()) {
ObjectId id = ref.getObjectId();
@@ -298,6 +301,8 @@
*/
public NameRevCommand addRef(Ref ref) {
checkCallable();
+ if (refs == null)
+ refs = new ArrayList<Ref>();
refs.add(ref);
return this;
}
@@ -312,7 +317,7 @@
if (!prefixes.isEmpty()) {
for (String prefix : prefixes)
addPrefix(prefix, nonCommits, pending);
- } else if (refs.isEmpty())
+ } else if (refs == null)
addPrefix(Constants.R_REFS, nonCommits, pending);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
index c157f14..d92adfe 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
@@ -111,16 +111,18 @@
/**
* Set if rebase should be used after fetching. If set to true, rebase is
- * used instead of merge. This is equivalent to --rebase on the command line.
- * <p/>
- * If set to false, merge is used after fetching, overriding the configuration
- * file. This is equivalent to --no-rebase on the command line.
- * <p/>
- * This setting overrides the settings in the configuration file.
- * By default, the setting in the repository configuration file is used.
- * <p/>
- * A branch can be configured to use rebase by default.
- * See branch.[name].rebase and branch.autosetuprebase.
+ * used instead of merge. This is equivalent to --rebase on the command
+ * line.
+ * <p>
+ * If set to false, merge is used after fetching, overriding the
+ * configuration file. This is equivalent to --no-rebase on the command
+ * line.
+ * <p>
+ * This setting overrides the settings in the configuration file. By
+ * default, the setting in the repository configuration file is used.
+ * <p>
+ * A branch can be configured to use rebase by default. See
+ * branch.[name].rebase and branch.autosetuprebase.
*
* @param useRebase
* @return {@code this}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
index cb1e6cf..3b84917 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
@@ -162,7 +162,7 @@
private static final String AUTOSTASH = "autostash"; //$NON-NLS-1$
- private static final String AUTOSTASH_MSG = "On {0}: autostash";
+ private static final String AUTOSTASH_MSG = "On {0}: autostash"; //$NON-NLS-1$
/**
* The available operations
@@ -621,6 +621,9 @@
sb.setLength(0);
sb.append("# This is a combination of ").append(count)
.append(" commits.\n");
+ // Add the previous message without header (i.e first line)
+ sb.append(currSquashMessage.substring(currSquashMessage.indexOf("\n") + 1));
+ sb.append("\n");
if (isSquash) {
sb.append("# This is the ").append(count).append(ordinal)
.append(" commit message:\n");
@@ -631,9 +634,6 @@
sb.append(commitToPick.getFullMessage().replaceAll("([\n\r])",
"$1# "));
}
- // Add the previous message without header (i.e first line)
- sb.append("\n");
- sb.append(currSquashMessage.substring(currSquashMessage.indexOf("\n") + 1));
return sb.toString();
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java
index 06b2aec..24409ee 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java
@@ -372,7 +372,7 @@
* <li><i>file modify</i>: always {@link #getOldPath()}</li>
* <li><i>file delete</i>: always <code>/dev/null</code></li>
* <li><i>file copy</i>: destination file the copy ends up at</li>
- * <li><i>file rename</i>: destination file the rename ends up at/li>
+ * <li><i>file rename</i>: destination file the rename ends up at</li>
* </ul>
*
* @return new name for this file.
@@ -453,7 +453,7 @@
* <pre>
* TreeFilter filterA = ...;
* TreeFilter filterB = ...;
- * List<DiffEntry> entries = DiffEntry.scan(walk, false, filterA, filterB);
+ * List<DiffEntry> entries = DiffEntry.scan(walk, false, filterA, filterB);
* DiffEntry entry = entries.get(0);
* boolean filterAMatched = entry.isMarked(0);
* boolean filterBMatched = entry.isMarked(1);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java
index 684c066..57a2018 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/Edit.java
@@ -51,16 +51,16 @@
* Regions should be specified using 0 based notation, so add 1 to the start and
* end marks for line numbers in a file.
* <p>
- * An edit where <code>beginA == endA && beginB < endB</code> is an insert edit,
- * that is sequence B inserted the elements in region
+ * An edit where <code>beginA == endA && beginB < endB</code> is an insert
+ * edit, that is sequence B inserted the elements in region
* <code>[beginB, endB)</code> at <code>beginA</code>.
* <p>
- * An edit where <code>beginA < endA && beginB == endB</code> is a delete edit,
- * that is sequence B has removed the elements between
+ * An edit where <code>beginA < endA && beginB == endB</code> is a delete
+ * edit, that is sequence B has removed the elements between
* <code>[beginA, endA)</code>.
* <p>
- * An edit where <code>beginA < endA && beginB < endB</code> is a replace edit,
- * that is sequence B has replaced the range of elements between
+ * An edit where <code>beginA < endA && beginB < endB</code> is a replace
+ * edit, that is sequence B has replaced the range of elements between
* <code>[beginA, endA)</code> with those found in <code>[beginB, endB)</code>.
*/
public class Edit {
@@ -105,11 +105,11 @@
* @param as
* beginA: start of region in sequence A; 0 based.
* @param ae
- * endA: end of region in sequence A; must be >= as.
+ * endA: end of region in sequence A; must be >= as.
* @param bs
* beginB: start of region in sequence B; 0 based.
* @param be
- * endB: end of region in sequence B; must be >= bs.
+ * endB: end of region in sequence B; must be > = bs.
*/
public Edit(final int as, final int ae, final int bs, final int be) {
beginA = as;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java
index 86af86d..a415ad3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/MyersDiff.java
@@ -167,11 +167,21 @@
}
/**
- * Calculates the differences between a given part of A against another given part of B
- * @param beginA start of the part of A which should be compared (0<=beginA<sizeof(A))
- * @param endA end of the part of A which should be compared (beginA<=endA<sizeof(A))
- * @param beginB start of the part of B which should be compared (0<=beginB<sizeof(B))
- * @param endB end of the part of B which should be compared (beginB<=endB<sizeof(B))
+ * Calculates the differences between a given part of A against another
+ * given part of B
+ *
+ * @param beginA
+ * start of the part of A which should be compared
+ * (0<=beginA<sizeof(A))
+ * @param endA
+ * end of the part of A which should be compared
+ * (beginA<=endA<sizeof(A))
+ * @param beginB
+ * start of the part of B which should be compared
+ * (0<=beginB<sizeof(B))
+ * @param endB
+ * end of the part of B which should be compared
+ * (beginB<=endB<sizeof(B))
*/
protected void calculateEdits(int beginA, int endA,
int beginB, int endB) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
index 68e088b..645de27 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java
@@ -730,14 +730,14 @@
}
/**
- * Locate the position a path's entry is at in the index.
- * For details refer to #findEntry(byte[], int).
+ * Locate the position a path's entry is at in the index. For details refer
+ * to #findEntry(byte[], int).
*
* @param path
* the path to search for.
- * @return if >= 0 then the return value is the position of the entry in the
- * index; pass to {@link #getEntry(int)} to obtain the entry
- * information. If < 0 the entry does not exist in the index.
+ * @return if >= 0 then the return value is the position of the entry in
+ * the index; pass to {@link #getEntry(int)} to obtain the entry
+ * information. If < 0 the entry does not exist in the index.
*/
public int findEntry(final String path) {
final byte[] p = Constants.encode(path);
@@ -758,9 +758,9 @@
* the byte array starting with the path to search for.
* @param pLen
* the length of the path in bytes
- * @return if >= 0 then the return value is the position of the entry in the
- * index; pass to {@link #getEntry(int)} to obtain the entry
- * information. If < 0 the entry does not exist in the index.
+ * @return if >= 0 then the return value is the position of the entry in
+ * the index; pass to {@link #getEntry(int)} to obtain the entry
+ * information. If < 0 the entry does not exist in the index.
* @since 3.4
*/
public int findEntry(final byte[] p, final int pLen) {
@@ -917,7 +917,7 @@
* returned tree identity.
* @return identity for the root tree.
* @throws UnmergedPathException
- * one or more paths contain higher-order stages (stage > 0),
+ * one or more paths contain higher-order stages (stage > 0),
* which cannot be stored in a tree object.
* @throws IllegalStateException
* one or more paths contain an invalid mode which should never
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
index 650accc..65188c8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
@@ -548,7 +548,7 @@
* <p>
* Note that this is the length of the file in the working directory, which
* may differ from the size of the decompressed blob if work tree filters
- * are being used, such as LF<->CRLF conversion.
+ * are being used, such as LF<->CRLF conversion.
* <p>
* Note also that for very large files, this is the size of the on-disk file
* truncated to 32 bits, i.e. modulo 4294967296. If that value is larger
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CorruptObjectException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CorruptObjectException.java
index 6104233..c6ea093 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CorruptObjectException.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CorruptObjectException.java
@@ -90,4 +90,19 @@
public CorruptObjectException(final String why) {
super(why);
}
+
+ /**
+ * Construct a CorruptObjectException for reporting a problem not associated
+ * with a specific object id.
+ *
+ * @param why
+ * message describing the corruption.
+ * @param cause
+ * optional root cause exception
+ * @since 3.4
+ */
+ public CorruptObjectException(String why, Throwable cause) {
+ super(why);
+ initCause(cause);
+ }
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java
index 02e4235..92a4837 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java
@@ -80,7 +80,6 @@
* </ul>
* e. g. [[:xdigit:]]</li>
* </ul>
- * </p>
* Any character can be escaped by prepending it with a \
*/
public class FileNameMatcher {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java
index 6784b49..593aaac 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java
@@ -56,6 +56,7 @@
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RefDatabase;
import org.eclipse.jgit.lib.RefRename;
+import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.SymbolicRef;
import org.eclipse.jgit.revwalk.RevObject;
import org.eclipse.jgit.revwalk.RevTag;
@@ -211,7 +212,7 @@
}
@Override
- public DfsRefUpdate newUpdate(String refName, boolean detach)
+ public RefUpdate newUpdate(String refName, boolean detach)
throws IOException {
boolean detachingSymbolicRef = false;
Ref ref = getOneRef(refName);
@@ -233,8 +234,8 @@
@Override
public RefRename newRename(String fromName, String toName)
throws IOException {
- DfsRefUpdate src = newUpdate(fromName, true);
- DfsRefUpdate dst = newUpdate(toName, true);
+ RefUpdate src = newUpdate(fromName, true);
+ RefUpdate dst = newUpdate(toName, true);
return new DfsRefRename(src, dst);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefRename.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefRename.java
index a4cb791..d9c2bc7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefRename.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefRename.java
@@ -47,10 +47,11 @@
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.RefRename;
+import org.eclipse.jgit.lib.RefUpdate;
import org.eclipse.jgit.lib.RefUpdate.Result;
final class DfsRefRename extends RefRename {
- DfsRefRename(DfsRefUpdate src, DfsRefUpdate dst) {
+ DfsRefRename(RefUpdate src, RefUpdate dst) {
super(src, dst);
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
index e06ff65..3cc4e7b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
@@ -481,7 +481,7 @@
* @throws IOException
*/
public void packRefs() throws IOException {
- Collection<Ref> refs = repo.getRefDatabase().getRefs(ALL).values();
+ Collection<Ref> refs = repo.getRefDatabase().getRefs(Constants.R_REFS).values();
List<String> refsToBePacked = new ArrayList<String>(refs.size());
pm.beginTask(JGitText.get().packRefs, refs.size());
try {
@@ -714,26 +714,27 @@
JGitText.get().cannotCreateIndexfile, tmpIdx.getPath()));
// write the packfile
- @SuppressWarnings("resource" /* java 7 */)
- FileChannel channel = new FileOutputStream(tmpPack).getChannel();
+ FileOutputStream fos = new FileOutputStream(tmpPack);
+ FileChannel channel = fos.getChannel();
OutputStream channelStream = Channels.newOutputStream(channel);
try {
pw.writePack(pm, pm, channelStream);
} finally {
channel.force(true);
channelStream.close();
- channel.close();
+ fos.close();
}
// write the packindex
- FileChannel idxChannel = new FileOutputStream(tmpIdx).getChannel();
+ fos = new FileOutputStream(tmpIdx);
+ FileChannel idxChannel = fos.getChannel();
OutputStream idxStream = Channels.newOutputStream(idxChannel);
try {
pw.writeIndex(idxStream);
} finally {
idxChannel.force(true);
idxStream.close();
- idxChannel.close();
+ fos.close();
}
if (pw.prepareBitmapIndex(pm)) {
@@ -745,14 +746,15 @@
JGitText.get().cannotCreateIndexfile,
tmpBitmapIdx.getPath()));
- idxChannel = new FileOutputStream(tmpBitmapIdx).getChannel();
+ fos = new FileOutputStream(tmpBitmapIdx);
+ idxChannel = fos.getChannel();
idxStream = Channels.newOutputStream(idxChannel);
try {
pw.writeBitmapIndex(idxStream);
} finally {
idxChannel.force(true);
idxStream.close();
- idxChannel.close();
+ fos.close();
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java
index a712259..f3791e6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java
@@ -132,11 +132,13 @@
* <li>by providing iterator of {@link RevObject} specifying exact list and
* order of objects in pack</li>
* </ul>
+ * <p>
* Typical usage consists of creating instance intended for some pack,
* configuring options, preparing the list of objects by calling
* {@link #preparePack(Iterator)} or
* {@link #preparePack(ProgressMonitor, Collection, Collection)}, and finally
- * producing the stream with {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)}.
+ * producing the stream with
+ * {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)}.
* </p>
* <p>
* Class provide set of configurable options and {@link ProgressMonitor}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java
index 87dabd4..29a379e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AbbreviatedObjectId.java
@@ -325,7 +325,7 @@
return NB.compareUInt32(w5, mask(5, bs[p + 4]));
}
- /** @return value for a fan-out style map, only valid of length >= 2. */
+ /** @return value for a fan-out style map, only valid of length >= 2. */
public final int getFirstByte() {
return w1 >>> 24;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java
index 9db4a61..11081d5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/AnyObjectId.java
@@ -156,8 +156,8 @@
*
* @param other
* the other id to compare to. Must not be null.
- * @return < 0 if this id comes before other; 0 if this id is equal to
- * other; > 0 if this id comes after other.
+ * @return < 0 if this id comes before other; 0 if this id is equal to
+ * other; > 0 if this id comes after other.
*/
public final int compareTo(final AnyObjectId other) {
if (this == other)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java
index 18adb9a..962f2e7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/CoreConfig.java
@@ -64,13 +64,13 @@
/** Permissible values for {@code core.autocrlf}. */
public static enum AutoCRLF {
- /** Automatic CRLF->LF conversion is disabled. */
+ /** Automatic CRLF->LF conversion is disabled. */
FALSE,
- /** Automatic CRLF->LF conversion is enabled. */
+ /** Automatic CRLF->LF conversion is enabled. */
TRUE,
- /** CRLF->LF performed, but no LF->CRLF. */
+ /** CRLF->LF performed, but no LF->CRLF. */
INPUT;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java
index 1b135a9..d8a70c1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java
@@ -382,7 +382,7 @@
throw new CorruptObjectException("truncated in name");
checkPathSegment2(raw, thisNameB, ptr);
if (normalized != null) {
- if (normalized.add(normalize(raw, thisNameB, ptr)))
+ if (!normalized.add(normalize(raw, thisNameB, ptr)))
throw new CorruptObjectException("duplicate entry names");
} else if (duplicateName(raw, thisNameB, ptr))
throw new CorruptObjectException("duplicate entry names");
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefComparator.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefComparator.java
index f14488b..c6e1029 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefComparator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefComparator.java
@@ -66,7 +66,7 @@
/**
* Sorts the collection of refs, returning a new collection.
- *
+ *
* @param refs
* collection to be sorted
* @return sorted collection of refs
@@ -79,12 +79,12 @@
/**
* Compare a reference to a name.
- *
+ *
* @param o1
* the reference instance.
* @param o2
* the name to compare to.
- * @return standard Comparator result of < 0, 0, > 0.
+ * @return standard Comparator result of < 0, 0, > 0.
*/
public static int compareTo(Ref o1, String o2) {
return o1.getName().compareTo(o2);
@@ -92,12 +92,12 @@
/**
* Compare two references by name.
- *
+ *
* @param o1
* the reference instance.
* @param o2
* the other reference instance.
- * @return standard Comparator result of < 0, 0, > 0.
+ * @return standard Comparator result of < 0, 0, > 0.
*/
public static int compareTo(final Ref o1, final Ref o2) {
return o1.getName().compareTo(o2.getName());
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java
index d257ba9..43bd489 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Tree.java
@@ -81,7 +81,7 @@
* @param lasta '/' if a is a tree, else NUL
* @param lastb '/' if b is a tree, else NUL
*
- * @return < 0 if a is sorted before b, 0 if they are the same, else b
+ * @return < 0 if a is sorted before b, 0 if they are the same, else b
*/
public static final int compareNames(final byte[] a, final byte[] b, final int lasta,final int lastb) {
return compareNames(a, b, 0, b.length, lasta, lastb);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeFormatter.java
index db0694b..065b8f4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeFormatter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/TreeFormatter.java
@@ -111,7 +111,7 @@
}
/**
- * Add a link to a submodule commit, mode is {@link #GITLINK}.
+ * Add a link to a submodule commit, mode is {@link FileMode#GITLINK}.
*
* @param name
* name of the entry.
@@ -123,7 +123,7 @@
}
/**
- * Add a subtree, mode is {@link #TREE}.
+ * Add a subtree, mode is {@link FileMode#TREE}.
*
* @param name
* name of the entry.
@@ -135,7 +135,7 @@
}
/**
- * Add a regular file, mode is {@link #REGULAR_FILE}.
+ * Add a regular file, mode is {@link FileMode#REGULAR_FILE}.
*
* @param name
* name of the entry.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java
index 1ba8086..eed1dcf 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java
@@ -68,7 +68,7 @@
* the merge result which should be presented
* @param seqName
* When a conflict is reported each conflicting range will get a
- * name. This name is following the "<<<<<<< " or ">>>>>>> "
+ * name. This name is following the "<<<<<<< " or ">>>>>>> "
* conflict markers. The names for the sequences are given in
* this list
* @param charsetName
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/notes/DefaultNoteMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/notes/DefaultNoteMerger.java
index 9624e49..db49448 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/notes/DefaultNoteMerger.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/notes/DefaultNoteMerger.java
@@ -82,8 +82,12 @@
ObjectLoader lt = reader.open(theirs.getData());
UnionInputStream union = new UnionInputStream(lo.openStream(),
lt.openStream());
- ObjectId noteData = inserter.insert(Constants.OBJ_BLOB,
- lo.getSize() + lt.getSize(), union);
- return new Note(ours, noteData);
+ try {
+ ObjectId noteData = inserter.insert(Constants.OBJ_BLOB,
+ lo.getSize() + lt.getSize(), union);
+ return new Note(ours, noteData);
+ } finally {
+ union.close();
+ }
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java
index f233923..b061d6a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java
@@ -124,7 +124,7 @@
* Extract the email address (if present) from the footer.
* <p>
* If there is an email address looking string inside of angle brackets
- * (e.g. "<a@b>"), the return value is the part extracted from inside the
+ * (e.g. "<a@b>"), the return value is the part extracted from inside the
* brackets. If no brackets are found, then {@link #getValue()} is returned
* if the value contains an '@' sign. Otherwise, null.
*
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommitList.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommitList.java
index 3498059..835e0ce 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommitList.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommitList.java
@@ -344,7 +344,8 @@
* walker specified by {@link #source(RevWalk)} is pumped until the
* specified commit is loaded. Callers can test the final size of the list
* by {@link #size()} to determine if the high water mark specified was met.
- * <p/>
+ * <p>
+ *
* @param commitToLoad
* commit the caller wants this list to contain when the fill
* operation is complete.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java
index e321953..a8835b7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackConfig.java
@@ -599,7 +599,7 @@
* Default setting: 0 (auto-detect processors)
*
* @param threads
- * number of threads to use. If <= 0 the number of available
+ * number of threads to use. If <= 0 the number of available
* processors for this JVM is used.
*/
public void setThreads(int threads) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java
index d701488..36d429a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java
@@ -148,6 +148,9 @@
FS fs, String user, final String pass, String host, int port,
final OpenSshConfig.Host hc) throws JSchException {
final Session session = createSession(hc, user, host, port, fs);
+ // We retry already in getSession() method. JSch must not retry
+ // on its own.
+ session.setConfig("MaxAuthTries", "1"); //$NON-NLS-1$ //$NON-NLS-2$
if (pass != null)
session.setPassword(pass);
final String strictHostKeyCheckingPolicy = hc
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
index 93522c1..c3fdacc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java
@@ -1014,9 +1014,11 @@
try {
objCheck.check(type, data);
} catch (CorruptObjectException e) {
- throw new IOException(MessageFormat.format(
- JGitText.get().invalidObject, Constants
- .typeString(type), id.name(), e.getMessage()));
+ throw new CorruptObjectException(MessageFormat.format(
+ JGitText.get().invalidObject,
+ Constants.typeString(type),
+ readCurs.abbreviate(id, 10).name(),
+ e.getMessage()), e);
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
index fe55e23..5885e7b 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
@@ -471,12 +471,14 @@
if (authMethod == HttpAuthMethod.NONE)
throw new TransportException(uri, MessageFormat.format(
JGitText.get().authenticationNotSupported, uri));
- if (1 < authAttempts
- || !authMethod.authorize(uri,
- getCredentialsProvider())) {
+ CredentialsProvider credentialsProvider = getCredentialsProvider();
+ if (3 < authAttempts
+ || !authMethod.authorize(uri, credentialsProvider)) {
+ credentialsProvider.reset(uri);
throw new TransportException(uri,
JGitText.get().notAuthorized);
}
+ credentialsProvider.reset(uri);
authAttempts++;
continue;
@@ -504,7 +506,7 @@
/**
* Open an HTTP connection.
- *
+ *
* @param method
* @param u
* @return the connection
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
index bd65182..aae898d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/URIish.java
@@ -65,8 +65,8 @@
/**
* This URI like construct used for referencing Git archives over the net, as
* well as locally stored archives. It is similar to RFC 2396 URI's, but also
- * support SCP and the malformed file://<path> syntax (as opposed to the correct
- * file:<path> syntax.
+ * support SCP and the malformed file://<path> syntax (as opposed to the correct
+ * file:<path> syntax.
*/
public class URIish implements Serializable {
/**
@@ -660,7 +660,7 @@
/**
* Get the "humanish" part of the path. Some examples of a 'humanish' part
* for a full path:
- * <table>
+ * <table summary="path vs humanish path" border="1">
* <tr>
* <th>Path</th>
* <th>Humanish part</th>
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/CanonicalTreeParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/CanonicalTreeParser.java
index 57bbd64..0805e50 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/CanonicalTreeParser.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/CanonicalTreeParser.java
@@ -110,8 +110,9 @@
/**
* @return the parent of this tree parser
- * @internal
+ * @deprecated internal use only
*/
+ @Deprecated
public CanonicalTreeParser getParent() {
return (CanonicalTreeParser) parent;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
index 90850ea..94281fb 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
@@ -777,7 +777,7 @@
* end with '/' prior to invocation.
* @param pLen
* number of bytes from <code>buf</code> to test.
- * @return < 0 if p is before the current path; 0 if p matches the current
+ * @return < 0 if p is before the current path; 0 if p matches the current
* path; 1 if the current path is past p and p will never match
* again on this tree walk.
*/
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
index 834cc85..b77807c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java
@@ -193,7 +193,7 @@
* the method fails. Furthermore if the destination exists and is a file
* then the file will be deleted and then the rename is retried.
* <p>
- * This operation is <em>not</me> atomic.
+ * This operation is <em>not</em> atomic.
*
* @see FS#retryFailedLockFileCommit()
* @param src
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java
index 0975cd3..c817c47 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java
@@ -317,7 +317,7 @@
* @param fd
* the stream to skip bytes from.
* @param toSkip
- * total number of bytes to be discarded. Must be >= 0.
+ * total number of bytes to be discarded. Must be >= 0.
* @throws EOFException
* the stream ended before the requested number of bytes were
* skipped.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/IntList.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/IntList.java
index 3161b51..f7688e3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/IntList.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/IntList.java
@@ -44,7 +44,7 @@
package org.eclipse.jgit.util;
-/** A more efficient List<Integer> using a primitive integer array. */
+/** A more efficient List<Integer> using a primitive integer array. */
public class IntList {
private int[] entries;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/LongList.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/LongList.java
index d62203c..dc4004f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/LongList.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/LongList.java
@@ -46,7 +46,7 @@
import java.util.Arrays;
-/** A more efficient List<Long> using a primitive long array. */
+/** A more efficient List<Long> using a primitive long array. */
public class LongList {
private long[] entries;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/NB.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/NB.java
index e110c11..85c1648 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/NB.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/NB.java
@@ -56,7 +56,7 @@
* the first value to compare.
* @param b
* the second value to compare.
- * @return < 0 if a < b; 0 if a == b; > 0 if a > b.
+ * @return < 0 if a < b; 0 if a == b; > 0 if a > b.
*/
public static int compareUInt32(final int a, final int b) {
final int cmp = (a >>> 1) - (b >>> 1);
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java
index 2f9a6d1..3c2460c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RawParseUtils.java
@@ -982,7 +982,7 @@
* Decode a region of the buffer under the ISO-8859-1 encoding.
*
* Each byte is treated as a single character in the 8859-1 character
- * encoding, performing a raw binary->char conversion.
+ * encoding, performing a raw binary->char conversion.
*
* @param buffer
* buffer to pull raw bytes from.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java
index 0e58c4b..1024380 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/InterruptTimer.java
@@ -113,7 +113,7 @@
*
* @param timeout
* number of milliseconds before the interrupt should trigger.
- * Must be > 0.
+ * Must be > 0.
*/
public void begin(final int timeout) {
if (timeout <= 0)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java
index fe452c2..1148895 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutInputStream.java
@@ -79,7 +79,7 @@
/**
* @param millis
- * number of milliseconds before aborting a read. Must be > 0.
+ * number of milliseconds before aborting a read. Must be > 0.
*/
public void setTimeout(final int millis) {
if (millis < 0)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java
index 7ca11ca..9236d0e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TimeoutOutputStream.java
@@ -80,7 +80,7 @@
/**
* @param millis
- * number of milliseconds before aborting a write. Must be > 0.
+ * number of milliseconds before aborting a write. Must be > 0.
*/
public void setTimeout(final int millis) {
if (millis < 0)
diff --git a/pom.xml b/pom.xml
index ecf2400..d4acb3e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -503,7 +503,7 @@
<profile>
<id>jgit.java6</id>
<activation>
- <jdk>1.6</jdk>
+ <jdk>[1.6,)</jdk>
</activation>
<modules>
<module>org.eclipse.jgit.console</module>
@@ -512,10 +512,9 @@
<profile>
<id>jgit.java7</id>
<activation>
- <jdk>1.7</jdk>
+ <jdk>[1.7,)</jdk>
</activation>
<modules>
- <module>org.eclipse.jgit.console</module>
<module>org.eclipse.jgit.java7</module>
<module>org.eclipse.jgit.java7.test</module>
</modules>