import org.eclipse.jgit.internal.storage.reftree.RefTree;
import org.eclipse.jgit.internal.storage.reftree.RefTreeDatabase;
import org.eclipse.jgit.lib.CommitBuilder;
+import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectInserter;
import org.eclipse.jgit.lib.ObjectReader;
if (enable && !(db.getRefDatabase() instanceof RefTreeDatabase)) {
StoredConfig cfg = db.getConfig();
- cfg.setInt("core", null, "repositoryformatversion", 1); //$NON-NLS-1$ //$NON-NLS-2$
- cfg.setString("extensions", null, "refStorage", "reftree"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ cfg.setInt(ConfigConstants.CONFIG_CORE_SECTION, null,
+ ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, 1);
+ cfg.setString(ConfigConstants.CONFIG_EXTENSIONS_SECTION, null,
+ ConfigConstants.CONFIG_KEY_REFSTORAGE,
+ ConfigConstants.CONFIG_REFSTORAGE_REFTREE);
cfg.save();
errw.println("Enabled reftree."); //$NON-NLS-1$
errw.flush();
ConfigConstants.CONFIG_KEY_REPO_FORMAT_VERSION, 0);
String reftype = repoConfig.getString(
- "extensions", null, "refStorage"); //$NON-NLS-1$ //$NON-NLS-2$
+ ConfigConstants.CONFIG_EXTENSIONS_SECTION, null,
+ ConfigConstants.CONFIG_KEY_REFSTORAGE);
if (repositoryFormatVersion >= 1 && reftype != null) {
- if (StringUtils.equalsIgnoreCase(reftype, "reftable")) { //$NON-NLS-1$
+ if (StringUtils.equalsIgnoreCase(reftype,
+ ConfigConstants.CONFIG_REFSTORAGE_REFTABLE)) {
refs = new FileReftableDatabase(this,
new File(getDirectory(), "refs")); //$NON-NLS-1$
- } else if (StringUtils.equalsIgnoreCase(reftype, "reftree")) { //$NON-NLS-1$
+ } else if (StringUtils.equalsIgnoreCase(reftype,
+ ConfigConstants.CONFIG_REFSTORAGE_REFTREE)) {
refs = new RefTreeDatabase(this, new RefDirectory(this));
} else {
throw new IOException(JGitText.get().unknownRepositoryFormat);
FileUtils.delete(reftableDir,
FileUtils.RECURSIVE | FileUtils.IGNORE_ERRORS);
}
+
+ repoConfig.unset(ConfigConstants.CONFIG_EXTENSIONS_SECTION, null,
+ ConfigConstants.CONFIG_KEY_REFSTORAGE);
+ repoConfig.save();
}
@SuppressWarnings("nls")
refs.close();
refs = new FileReftableDatabase(this, refsFile);
+
+ repoConfig.setString(ConfigConstants.CONFIG_EXTENSIONS_SECTION, null,
+ ConfigConstants.CONFIG_KEY_REFSTORAGE,
+ ConfigConstants.CONFIG_REFSTORAGE_REFTABLE);
+ repoConfig.save();
}
/**
/**
* The "minRacyThreshold" key
- *
* @since 5.1.9
*/
public static final String CONFIG_KEY_MIN_RACY_THRESHOLD = "minRacyThreshold";
+
+ /**
+ * The "extensions" section
+ * @since 5.7
+ */
+ public static final String CONFIG_EXTENSIONS_SECTION = "extensions";
+
+ /**
+ * The extensions.refStorage key
+ * @since 5.7
+ */
+ public static final String CONFIG_KEY_REFSTORAGE = "refStorage";
+
+ /**
+ * The "reftable" refStorage format
+ * @since 5.7
+ */
+ public static final String CONFIG_REFSTORAGE_REFTABLE = "reftable";
+
+ /**
+ * The "reftree" refStorage format
+ * @since 5.7
+ */
+ public static final String CONFIG_REFSTORAGE_REFTREE = "reftree";
}