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
;
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
;
37 public SetRepositoryConfigPropertyTask(String section
, String subsection
, String name
, String value
) {
38 this.section
= section
;
39 this.subsection
= subsection
;
45 public void execute(Repository repository
, IProgressMonitor monitor
)
46 throws CoreException
{
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
));