Blame SOURCES/eclipse-jgit-413163.patch

511781
From 964fdccf525e3be7eaf77747a0326920a84e67e4 Mon Sep 17 00:00:00 2001
d37b49
From: Robin Stocker <robin@nibor.org>
d37b49
Date: Thu, 18 Jul 2013 19:08:29 +0200
d37b49
Subject: [PATCH] Fix compilation errors with args4j 2.0.23 and later
d37b49
d37b49
The multiValued attribute on @Option was removed. When the field is a
d37b49
List, it's not actually needed (even with earlier versions of args4j),
d37b49
see RmTest. In other cases, we have a custom handler, where it's also
d37b49
not needed.
d37b49
d37b49
Bug: 413163
d37b49
Change-Id: I4bb951e9fab5f4ae4271bd7e11be799dc234ab80
d37b49
---
d37b49
 .../tst/org/eclipse/jgit/pgm/RmTest.java           | 80 ++++++++++++++++++++++
511781
 .../src/org/eclipse/jgit/pgm/Checkout.java         |  2 +-
d37b49
 .../src/org/eclipse/jgit/pgm/Daemon.java           |  8 +--
d37b49
 .../src/org/eclipse/jgit/pgm/Diff.java             |  2 +-
d37b49
 .../src/org/eclipse/jgit/pgm/DiffTree.java         |  2 +-
d37b49
 .../src/org/eclipse/jgit/pgm/LsTree.java           |  2 +-
d37b49
 .../org/eclipse/jgit/pgm/RevWalkTextBuiltin.java   |  2 +-
d37b49
 .../src/org/eclipse/jgit/pgm/Rm.java               |  4 +-
d37b49
 .../src/org/eclipse/jgit/pgm/Show.java             |  2 +-
511781
 .../src/org/eclipse/jgit/pgm/Status.java           |  2 +-
d37b49
 .../org/eclipse/jgit/pgm/debug/DiffAlgorithms.java |  4 +-
d37b49
 .../eclipse/jgit/pgm/debug/TextHashFunctions.java  |  6 +-
511781
 .../org/eclipse/jgit/pgm/opt/CmdLineParser.java    |  3 +-
511781
 13 files changed, 98 insertions(+), 21 deletions(-)
d37b49
 create mode 100644 org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RmTest.java
d37b49
d37b49
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RmTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RmTest.java
d37b49
new file mode 100644
d37b49
index 0000000..00a1a9a
d37b49
--- /dev/null
d37b49
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/RmTest.java
d37b49
@@ -0,0 +1,80 @@
d37b49
+/*
d37b49
+ * Copyright (C) 2013 Robin Stocker <robin@nibor.org> and others.
d37b49
+ *
d37b49
+ * This program and the accompanying materials are made available
d37b49
+ * under the terms of the Eclipse Distribution License v1.0 which
d37b49
+ * accompanies this distribution, is reproduced below, and is
d37b49
+ * available at http://www.eclipse.org/org/documents/edl-v10.php
d37b49
+ *
d37b49
+ * All rights reserved.
d37b49
+ *
d37b49
+ * Redistribution and use in source and binary forms, with or
d37b49
+ * without modification, are permitted provided that the following
d37b49
+ * conditions are met:
d37b49
+ *
d37b49
+ * - Redistributions of source code must retain the above copyright
d37b49
+ *   notice, this list of conditions and the following disclaimer.
d37b49
+ *
d37b49
+ * - Redistributions in binary form must reproduce the above
d37b49
+ *   copyright notice, this list of conditions and the following
d37b49
+ *   disclaimer in the documentation and/or other materials provided
d37b49
+ *   with the distribution.
d37b49
+ *
d37b49
+ * - Neither the name of the Eclipse Foundation, Inc. nor the
d37b49
+ *   names of its contributors may be used to endorse or promote
d37b49
+ *   products derived from this software without specific prior
d37b49
+ *   written permission.
d37b49
+ *
d37b49
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
d37b49
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
d37b49
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
d37b49
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
d37b49
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
d37b49
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
d37b49
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
d37b49
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
d37b49
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
d37b49
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
d37b49
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
d37b49
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
d37b49
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
d37b49
+ */
d37b49
+package org.eclipse.jgit.pgm;
d37b49
+
d37b49
+import static org.junit.Assert.assertArrayEquals;
d37b49
+import static org.junit.Assert.assertFalse;
d37b49
+import static org.junit.Assert.assertNull;
d37b49
+
d37b49
+import java.io.File;
d37b49
+
d37b49
+import org.eclipse.jgit.api.Git;
d37b49
+import org.eclipse.jgit.dircache.DirCache;
d37b49
+import org.eclipse.jgit.lib.CLIRepositoryTestCase;
d37b49
+import org.junit.Before;
d37b49
+import org.junit.Test;
d37b49
+
d37b49
+public class RmTest extends CLIRepositoryTestCase {
d37b49
+	private Git git;
d37b49
+
d37b49
+	@Override
d37b49
+	@Before
d37b49
+	public void setUp() throws Exception {
d37b49
+		super.setUp();
d37b49
+		git = new Git(db);
d37b49
+	}
d37b49
+
d37b49
+	@Test
d37b49
+	public void multiplePathsShouldBeRemoved() throws Exception {
d37b49
+		File a = writeTrashFile("a", "Hello");
d37b49
+		File b = writeTrashFile("b", "world!");
d37b49
+		git.add().addFilepattern("a").addFilepattern("b").call();
d37b49
+
d37b49
+		String[] result = execute("git rm a b");
d37b49
+		assertArrayEquals(new String[] { "" }, result);
d37b49
+		DirCache cache = db.readDirCache();
d37b49
+		assertNull(cache.getEntry("a"));
d37b49
+		assertNull(cache.getEntry("b"));
d37b49
+		assertFalse(a.exists());
d37b49
+		assertFalse(b.exists());
d37b49
+	}
d37b49
+}
511781
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java
511781
index 8f911fd..e424bf7 100644
511781
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java
511781
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java
511781
@@ -75,7 +75,7 @@
511781
 	private String name;
511781
 
511781
 	@Argument(index = 1)
511781
-	@Option(name = "--", metaVar = "metaVar_paths", multiValued = true, handler = StopOptionHandler.class)
511781
+	@Option(name = "--", metaVar = "metaVar_paths", handler = StopOptionHandler.class)
511781
 	private List<String> paths = new ArrayList<String>();
511781
 
511781
 	@Override
d37b49
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java
d37b49
index 04182d6..9ef8e49 100644
d37b49
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java
d37b49
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java
d37b49
@@ -75,16 +75,16 @@
d37b49
 	@Option(name = "--timeout", metaVar = "metaVar_seconds", usage = "usage_abortConnectionIfNoActivity")
d37b49
 	int timeout = -1;
d37b49
 
d37b49
-	@Option(name = "--enable", metaVar = "metaVar_service", usage = "usage_enableTheServiceInAllRepositories", multiValued = true)
d37b49
+	@Option(name = "--enable", metaVar = "metaVar_service", usage = "usage_enableTheServiceInAllRepositories")
d37b49
 	final List<String> enable = new ArrayList<String>();
d37b49
 
d37b49
-	@Option(name = "--disable", metaVar = "metaVar_service", usage = "usage_disableTheServiceInAllRepositories", multiValued = true)
d37b49
+	@Option(name = "--disable", metaVar = "metaVar_service", usage = "usage_disableTheServiceInAllRepositories")
d37b49
 	final List<String> disable = new ArrayList<String>();
d37b49
 
d37b49
-	@Option(name = "--allow-override", metaVar = "metaVar_service", usage = "usage_configureTheServiceInDaemonServicename", multiValued = true)
d37b49
+	@Option(name = "--allow-override", metaVar = "metaVar_service", usage = "usage_configureTheServiceInDaemonServicename")
d37b49
 	final List<String> canOverride = new ArrayList<String>();
d37b49
 
d37b49
-	@Option(name = "--forbid-override", metaVar = "metaVar_service", usage = "usage_configureTheServiceInDaemonServicename", multiValued = true)
d37b49
+	@Option(name = "--forbid-override", metaVar = "metaVar_service", usage = "usage_configureTheServiceInDaemonServicename")
d37b49
 	final List<String> forbidOverride = new ArrayList<String>();
d37b49
 
d37b49
 	@Option(name = "--export-all", usage = "usage_exportWithoutGitDaemonExportOk")
d37b49
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
d37b49
index 8f05168..3db8ce2 100644
d37b49
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
d37b49
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
d37b49
@@ -89,7 +89,7 @@
d37b49
 	@Option(name = "--cached", usage = "usage_cached")
d37b49
 	private boolean cached;
d37b49
 
d37b49
-	@Option(name = "--", metaVar = "metaVar_paths", multiValued = true, handler = PathTreeFilterHandler.class)
d37b49
+	@Option(name = "--", metaVar = "metaVar_paths", handler = PathTreeFilterHandler.class)
d37b49
 	private TreeFilter pathFilter = TreeFilter.ALL;
d37b49
 
d37b49
 	// BEGIN -- Options shared with Log
d37b49
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java
511781
index d89053c..90d7c06 100644
d37b49
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java
d37b49
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java
511781
@@ -69,7 +69,7 @@ void tree_0(final AbstractTreeIterator c) {
d37b49
 	@Argument(index = 1, metaVar = "metaVar_treeish", required = true)
d37b49
 	private final List<AbstractTreeIterator> trees = new ArrayList<AbstractTreeIterator>();
d37b49
 
d37b49
-	@Option(name = "--", metaVar = "metaVar_path", multiValued = true, handler = PathTreeFilterHandler.class)
d37b49
+	@Option(name = "--", metaVar = "metaVar_path", handler = PathTreeFilterHandler.class)
d37b49
 	private TreeFilter pathFilter = TreeFilter.ALL;
d37b49
 
d37b49
 	@Override
d37b49
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java
511781
index 4b16ed8..4da8e09 100644
d37b49
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java
d37b49
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java
511781
@@ -67,7 +67,7 @@
d37b49
 	private AbstractTreeIterator tree;
d37b49
 
d37b49
 	@Argument(index = 1)
d37b49
-	@Option(name = "--", metaVar = "metaVar_paths", multiValued = true, handler = StopOptionHandler.class)
d37b49
+	@Option(name = "--", metaVar = "metaVar_paths", handler = StopOptionHandler.class)
d37b49
 	private List<String> paths = new ArrayList<String>();
d37b49
 
d37b49
 	@Override
d37b49
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
511781
index d6063c3..a223587 100644
d37b49
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java
d37b49
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java
511781
@@ -126,7 +126,7 @@ void enableBoundary(final boolean on) {
d37b49
 	@Argument(index = 0, metaVar = "metaVar_commitish")
d37b49
 	private final List<RevCommit> commits = new ArrayList<RevCommit>();
d37b49
 
d37b49
-	@Option(name = "--", metaVar = "metaVar_path", multiValued = true, handler = PathTreeFilterHandler.class)
d37b49
+	@Option(name = "--", metaVar = "metaVar_path", handler = PathTreeFilterHandler.class)
d37b49
 	protected TreeFilter pathFilter = TreeFilter.ALL;
d37b49
 
d37b49
 	private final List<RevFilter> revLimiter = new ArrayList<RevFilter>();
d37b49
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java
d37b49
index 816b310..0b6f522 100644
d37b49
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java
d37b49
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java
d37b49
@@ -55,12 +55,10 @@
d37b49
 
d37b49
 @Command(usage = "usage_StopTrackingAFile", common = true)
d37b49
 class Rm extends TextBuiltin {
d37b49
-	@Argument(metaVar = "metaVar_path", usage = "usage_path", multiValued = true, required = true)
d37b49
-
d37b49
+	@Argument(metaVar = "metaVar_path", usage = "usage_path", required = true)
d37b49
 	@Option(name = "--", handler = StopOptionHandler.class)
d37b49
 	private List<String> paths = new ArrayList<String>();
d37b49
 
d37b49
-
d37b49
 	@Override
d37b49
 	protected void run() throws Exception {
d37b49
 		RmCommand command = new Git(db).rm();
d37b49
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java
d37b49
index a33a2d4..bcff628 100644
d37b49
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java
d37b49
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Show.java
d37b49
@@ -87,7 +87,7 @@
d37b49
 	@Argument(index = 0, metaVar = "metaVar_object")
d37b49
 	private String objectName;
d37b49
 
d37b49
-	@Option(name = "--", metaVar = "metaVar_path", multiValued = true, handler = PathTreeFilterHandler.class)
d37b49
+	@Option(name = "--", metaVar = "metaVar_path", handler = PathTreeFilterHandler.class)
d37b49
 	protected TreeFilter pathFilter = TreeFilter.ALL;
d37b49
 
d37b49
 	// BEGIN -- Options shared with Diff
511781
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java
511781
index 2ae950b..0bab32e 100644
511781
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java
511781
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java
511781
@@ -75,7 +75,7 @@
511781
 	@Option(name = "--porcelain", usage = "usage_machineReadableOutput")
511781
 	protected boolean porcelain;
511781
 
511781
-	@Option(name = "--", metaVar = "metaVar_path", multiValued = true)
511781
+	@Option(name = "--", metaVar = "metaVar_path")
511781
 	protected List<String> filterPaths;
511781
 
511781
 	@Override
d37b49
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
511781
index 91b5917..ed2818d 100644
d37b49
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
d37b49
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java
511781
@@ -111,13 +111,13 @@ DiffAlgorithm create() {
d37b49
 	//
d37b49
 	//
d37b49
 
d37b49
-	@Option(name = "--algorithm", multiValued = true, metaVar = "NAME", usage = "Enable algorithm(s)")
d37b49
+	@Option(name = "--algorithm", metaVar = "NAME", usage = "Enable algorithm(s)")
d37b49
 	List<String> algorithms = new ArrayList<String>();
d37b49
 
d37b49
 	@Option(name = "--text-limit", metaVar = "LIMIT", usage = "Maximum size in KiB to scan per file revision")
d37b49
 	int textLimit = 15 * 1024; // 15 MiB as later we do * 1024.
d37b49
 
d37b49
-	@Option(name = "--repository", aliases = { "-r" }, multiValued = true, metaVar = "GIT_DIR", usage = "Repository to scan")
d37b49
+	@Option(name = "--repository", aliases = { "-r" }, metaVar = "GIT_DIR", usage = "Repository to scan")
d37b49
 	List<File> gitDirs = new ArrayList<File>();
d37b49
 
d37b49
 	@Option(name = "--count", metaVar = "LIMIT", usage = "Number of file revisions to be compared")
d37b49
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
511781
index 4205140..72425f1 100644
d37b49
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
d37b49
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
511781
@@ -250,16 +250,16 @@ public int fold(int hash, int bits) {
d37b49
 	//
d37b49
 	//
d37b49
 
d37b49
-	@Option(name = "--hash", multiValued = true, metaVar = "NAME", usage = "Enable hash function(s)")
d37b49
+	@Option(name = "--hash", metaVar = "NAME", usage = "Enable hash function(s)")
d37b49
 	List<String> hashFunctions = new ArrayList<String>();
d37b49
 
d37b49
-	@Option(name = "--fold", multiValued = true, metaVar = "NAME", usage = "Enable fold function(s)")
d37b49
+	@Option(name = "--fold", metaVar = "NAME", usage = "Enable fold function(s)")
d37b49
 	List<String> foldFunctions = new ArrayList<String>();
d37b49
 
d37b49
 	@Option(name = "--text-limit", metaVar = "LIMIT", usage = "Maximum size in KiB to scan")
d37b49
 	int textLimit = 15 * 1024; // 15 MiB as later we do * 1024.
d37b49
 
d37b49
-	@Option(name = "--repository", aliases = { "-r" }, multiValued = true, metaVar = "GIT_DIR", usage = "Repository to scan")
d37b49
+	@Option(name = "--repository", aliases = { "-r" }, metaVar = "GIT_DIR", usage = "Repository to scan")
d37b49
 	List<File> gitDirs = new ArrayList<File>();
d37b49
 
d37b49
 	@Override
511781
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java
511781
index 3f77aa6..b5d8d48 100644
511781
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java
511781
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java
511781
@@ -184,8 +184,7 @@ public RevWalk getRevWalkGently() {
d37b49
 	static class MyOptionDef extends OptionDef {
d37b49
 
d37b49
 		public MyOptionDef(OptionDef o) {
d37b49
-			super(o.usage(), o.metaVar(), o.required(), o.handler(), o
d37b49
-					.isMultiValued());
511781
+			super(o.usage(), o.metaVar(), o.required(), o.help(), o.hidden(), o.handler(), o.isMultiValued());
d37b49
 		}
d37b49
 
d37b49
 		@Override
511781
-- 
511781
2.1.0
511781