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 e8175d099..3ceeec42b 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> { private String remote = Constants.DEFAULT_REMOTE_NAME; - private List refSpecs; + private final List refSpecs; private ProgressMonitor monitor = NullProgressMonitor.INSTANCE; @@ -124,10 +124,8 @@ public class PushCommand extends GitCommand> { try { if (force) { - final List orig = new ArrayList(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 transports;