Java Code Examples for org.eclipse.jgit.util.FS#DETECTED

The following examples show how to use org.eclipse.jgit.util.FS#DETECTED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JGitHelper.java    From go-plugins with Apache License 2.0 6 votes vote down vote up
@Override
public void submoduleRemove(String folderName) {
    configRemoveSection(folderName);

    Repository repository = null;
    try {
        repository = getRepository(workingDir);

        StoredConfig gitSubmodulesConfig = new FileBasedConfig(null, new File(repository.getWorkTree(), Constants.DOT_GIT_MODULES), FS.DETECTED);
        gitSubmodulesConfig.unsetSection(ConfigConstants.CONFIG_SUBMODULE_SECTION, folderName);
        gitSubmodulesConfig.save();

        Git git = Git.wrap(repository);
        git.rm().setCached(true).addFilepattern(folderName).call();

        FileUtils.deleteQuietly(new File(workingDir, folderName));
    } catch (Exception e) {
        throw new RuntimeException("sub-module remove failed", e);
    } finally {
        if (repository != null) {
            repository.close();
        }
    }
}
 
Example 2
Source File: RepositoryInfo.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public NBGitConfig (File root) {
    this.config = new FileBasedConfig(new File(GitUtils.getGitFolderForRoot(root), NETBEANS_CONFIG_FILE), FS.DETECTED);
    saveTask = rp.create(new SaveTask());
}
 
Example 3
Source File: GitSubmoduleHandlerV1.java    From orion.server with Eclipse Public License 1.0 4 votes vote down vote up
private static StoredConfig getGitSubmodulesConfig( Repository repository ) throws IOException, ConfigInvalidException {
	File gitSubmodulesFile = new File( repository.getWorkTree(), DOT_GIT_MODULES );
	FileBasedConfig gitSubmodulesConfig = new FileBasedConfig( null, gitSubmodulesFile, FS.DETECTED );
	gitSubmodulesConfig.load();
	return gitSubmodulesConfig;
}