summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java
index e8175d0997..3ceeec42b0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java
@@ -78,7 +78,7 @@ public class PushCommand extends GitCommand<Iterable<PushResult>> {
private String remote = Constants.DEFAULT_REMOTE_NAME;
- private List<RefSpec> refSpecs;
+ private final List<RefSpec> refSpecs;
private ProgressMonitor monitor = NullProgressMonitor.INSTANCE;
@@ -124,10 +124,8 @@ public class PushCommand extends GitCommand<Iterable<PushResult>> {
try {
if (force) {
- final List<RefSpec> orig = new ArrayList<RefSpec>(refSpecs);
- refSpecs.clear();
- for (final RefSpec spec : orig)
- refSpecs.add(spec.setForceUpdate(true));
+ for (int i = 0; i < refSpecs.size(); i++)
+ refSpecs.set(i, refSpecs.get(i).setForceUpdate(true));
}
final List<Transport> transports;