Merge branch 'stable-6.2' into stable-6.3

* stable-6.2:
  Improve test coverage when core.trustPackedRefsStat set to after_open

Change-Id: I02d7444b28b662eb46f3d0ba1a62d342820bed1f
This commit is contained in:
Matthias Sohn 2023-03-03 16:02:16 +01:00
commit 9dd912a1c2
3 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,32 @@
/*
* Copyright (c) 2023 Qualcomm Innovation Center, Inc.
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0 which is available at
* https://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package org.eclipse.jgit.internal.storage.file;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.CoreConfig;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.util.SystemReader;
import org.junit.Before;
public class FileRepositoryBuilderAfterOpenConfigTest extends FileRepositoryBuilderTest {
/** {@inheritDoc} */
@Before
@Override
public void setUp() throws Exception {
super.setUp();
StoredConfig userConfig = SystemReader.getInstance().getUserConfig();
userConfig.setEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_TRUST_PACKED_REFS_STAT,
CoreConfig.TrustPackedRefsStat.AFTER_OPEN);
userConfig.save();
}
}

View File

@ -0,0 +1,30 @@
/*
* Copyright (c) 2023 Qualcomm Innovation Center, Inc.
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0 which is available at
* https://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package org.eclipse.jgit.internal.storage.file;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.CoreConfig;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.util.SystemReader;
public class RefDirectoryAfterOpenConfigTest extends RefDirectoryTest {
/** {@inheritDoc} */
@Override
public void refDirectorySetup() throws Exception {
StoredConfig userConfig = SystemReader.getInstance().getUserConfig();
userConfig.setEnum(ConfigConstants.CONFIG_CORE_SECTION, null,
ConfigConstants.CONFIG_KEY_TRUST_PACKED_REFS_STAT,
CoreConfig.TrustPackedRefsStat.AFTER_OPEN);
userConfig.save();
super.refDirectorySetup();
}
}

View File

@ -72,7 +72,10 @@ public class RefDirectoryTest extends LocalDiskRepositoryTestCase {
@Before
public void setUp() throws Exception {
super.setUp();
refDirectorySetup();
}
public void refDirectorySetup() throws Exception {
diskRepo = createBareRepository();
refdir = (RefDirectory) diskRepo.getRefDatabase();