Use CoreConfig, UserConfig and TransferConfig directly
Rather than relying on the helpers in RepositoryConfig to get these objects, obtain them directly through the Config API. Its only slightly more verbose, but permits us to work with the base Config class, which is more flexible than the highly file specific RepositoryConfig. This is what I really meant to do when I added the section parser and caching support to Config, we just failed to finish updating all of the call sites. Change-Id: I481cb365aa00bfa8c21e5ad0cd367ddd9c6c0edd Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
8e396bcddc
commit
e1b312b5f7
|
@ -49,6 +49,7 @@
|
|||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
import org.kohsuke.args4j.Option;
|
||||
import org.eclipse.jgit.lib.CoreConfig;
|
||||
import org.eclipse.jgit.lib.TextProgressMonitor;
|
||||
|
||||
class IndexPack extends TextBuiltin {
|
||||
|
@ -64,7 +65,8 @@ class IndexPack extends TextBuiltin {
|
|||
@Override
|
||||
protected void run() throws Exception {
|
||||
if (indexVersion == -1)
|
||||
indexVersion = db.getConfig().getCore().getPackIndexVersion();
|
||||
indexVersion = db.getConfig().get(CoreConfig.KEY)
|
||||
.getPackIndexVersion();
|
||||
final BufferedInputStream in;
|
||||
final org.eclipse.jgit.transport.IndexPack ip;
|
||||
in = new BufferedInputStream(System.in);
|
||||
|
|
|
@ -70,7 +70,7 @@ public void testlogAllRefUpdates() throws Exception {
|
|||
|
||||
// set the logAllRefUpdates parameter to true and check it
|
||||
db.getConfig().setBoolean("core", null, "logallrefupdates", true);
|
||||
assertTrue(db.getConfig().getCore().isLogAllRefUpdates());
|
||||
assertTrue(db.getConfig().get(CoreConfig.KEY).isLogAllRefUpdates());
|
||||
|
||||
// do one commit and check that reflog size is increased to 1
|
||||
addFileToTree(t, "i-am-another-file", "and this is other data in me\n");
|
||||
|
@ -83,7 +83,7 @@ public void testlogAllRefUpdates() throws Exception {
|
|||
|
||||
// set the logAllRefUpdates parameter to false and check it
|
||||
db.getConfig().setBoolean("core", null, "logallrefupdates", false);
|
||||
assertFalse(db.getConfig().getCore().isLogAllRefUpdates());
|
||||
assertFalse(db.getConfig().get(CoreConfig.KEY).isLogAllRefUpdates());
|
||||
|
||||
// do one commit and check that reflog size is 2
|
||||
addFileToTree(t, "i-am-anotheranother-file",
|
||||
|
|
|
@ -238,8 +238,10 @@ public PackWriter(final Repository repo, final ProgressMonitor imonitor,
|
|||
this.db = repo;
|
||||
initMonitor = imonitor == null ? NullProgressMonitor.INSTANCE : imonitor;
|
||||
writeMonitor = wmonitor == null ? NullProgressMonitor.INSTANCE : wmonitor;
|
||||
this.deflater = new Deflater(db.getConfig().getCore().getCompression());
|
||||
outputVersion = repo.getConfig().getCore().getPackIndexVersion();
|
||||
|
||||
final CoreConfig coreConfig = db.getConfig().get(CoreConfig.KEY);
|
||||
this.deflater = new Deflater(coreConfig.getCompression());
|
||||
outputVersion = coreConfig.getPackIndexVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -77,7 +77,7 @@ public class PersonIdent {
|
|||
* @param repo
|
||||
*/
|
||||
public PersonIdent(final Repository repo) {
|
||||
final RepositoryConfig config = repo.getConfig();
|
||||
final UserConfig config = repo.getConfig().get(UserConfig.KEY);
|
||||
name = config.getCommitterName();
|
||||
emailAddress = config.getCommitterEmail();
|
||||
when = SystemReader.getInstance().getCurrentTime();
|
||||
|
|
|
@ -590,7 +590,7 @@ else if (log.isFile())
|
|||
}
|
||||
|
||||
private boolean isLogAllRefUpdates() {
|
||||
return parent.getConfig().getCore().isLogAllRefUpdates();
|
||||
return parent.getConfig().get(CoreConfig.KEY).isLogAllRefUpdates();
|
||||
}
|
||||
|
||||
private boolean shouldAutoCreateLog(final String refName) {
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
import org.eclipse.jgit.lib.AnyObjectId;
|
||||
import org.eclipse.jgit.lib.BinaryDelta;
|
||||
import org.eclipse.jgit.lib.Constants;
|
||||
import org.eclipse.jgit.lib.CoreConfig;
|
||||
import org.eclipse.jgit.lib.InflaterCache;
|
||||
import org.eclipse.jgit.lib.MutableObjectId;
|
||||
import org.eclipse.jgit.lib.ObjectChecker;
|
||||
|
@ -127,7 +128,8 @@ public static IndexPack create(final Repository db, final InputStream is)
|
|||
|
||||
base = new File(objdir, n.substring(0, n.length() - suffix.length()));
|
||||
final IndexPack ip = new IndexPack(db, is, base);
|
||||
ip.setIndexVersion(db.getConfig().getCore().getPackIndexVersion());
|
||||
ip.setIndexVersion(db.getConfig().get(CoreConfig.KEY)
|
||||
.getPackIndexVersion());
|
||||
return ip;
|
||||
}
|
||||
|
||||
|
|
|
@ -566,7 +566,7 @@ private static String findTrackingRefName(final String remoteName,
|
|||
* URI passed to {@link #open(Repository, URIish)}.
|
||||
*/
|
||||
protected Transport(final Repository local, final URIish uri) {
|
||||
final TransferConfig tc = local.getConfig().getTransfer();
|
||||
final TransferConfig tc = local.getConfig().get(TransferConfig.KEY);
|
||||
this.local = local;
|
||||
this.uri = uri;
|
||||
this.checkFetchedObjects = tc.isFsckObjects();
|
||||
|
|
Loading…
Reference in New Issue