Rather than copying the entire list, just replace each element
with the version that has setForceUpdate(true) invoked on it.
Change-Id: I2eaa4466d497cb2408ce61dc62ca26e0c32fe841
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
private String remote = Constants.DEFAULT_REMOTE_NAME;
- private List<RefSpec> refSpecs;
+ private final List<RefSpec> refSpecs;
private ProgressMonitor monitor = NullProgressMonitor.INSTANCE;
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;