Avoid refresh on up-to-date pull operation
[egit/eclipse.git] / org.eclipse.egit.core / src / org / eclipse / egit / core / op / SetRepositoryConfigPropertyTask.java
blob7faad0edb9035810cd4accbfd2b645a04422b481
1 /*******************************************************************************
2 * Copyright (C) 2012, Stefan Lay <stefan.lay@sap.com>
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
9 * SPDX-License-Identifier: EPL-2.0
10 *******************************************************************************/
11 package org.eclipse.egit.core.op;
13 import java.io.IOException;
15 import org.eclipse.core.runtime.CoreException;
16 import org.eclipse.core.runtime.IProgressMonitor;
17 import org.eclipse.egit.core.Activator;
18 import org.eclipse.egit.core.op.CloneOperation.PostCloneTask;
19 import org.eclipse.jgit.lib.Repository;
21 /**
22 * Sets config properties for a repository
24 public class SetRepositoryConfigPropertyTask implements PostCloneTask {
26 private final String section;
27 private final String subsection;
28 private final String name;
29 private final String value;
31 /**
32 * @param section
33 * @param subsection
34 * @param name
35 * @param value
37 public SetRepositoryConfigPropertyTask(String section, String subsection, String name, String value) {
38 this.section = section;
39 this.subsection = subsection;
40 this.name = name;
41 this.value = value;
44 @Override
45 public void execute(Repository repository, IProgressMonitor monitor)
46 throws CoreException {
47 try {
48 repository.getConfig().setString(section, subsection, name, value);
49 repository.getConfig().save();
50 } catch (IOException e) {
51 throw new CoreException(Activator.error(e.getMessage(), e));