Enable git reflog for all newly created projects
Gerrit changed it's behavior with JGit commit ffc8b42957a2f294960d5ad027e2c7e41d3f70cd and since then sets core.logallrefupdates = false for new projects. Prior to that change Gerrit did set core.logallrefupdates = true for newly created projects. Reverting to the old behavior as being able to inspect the reflog is desirable. Change-Id: If6ffa8c98658c996a01811ccaa8823c7042af08a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
fdaa54f7fe
commit
0ff5ff0112
@ -34,6 +34,7 @@ import com.google.inject.Inject;
|
||||
|
||||
import org.apache.sshd.server.Environment;
|
||||
import org.eclipse.jgit.lib.CommitBuilder;
|
||||
import org.eclipse.jgit.lib.ConfigConstants;
|
||||
import org.eclipse.jgit.lib.Constants;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.lib.ObjectInserter;
|
||||
@ -41,6 +42,7 @@ import org.eclipse.jgit.lib.PersonIdent;
|
||||
import org.eclipse.jgit.lib.RefUpdate;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.lib.RefUpdate.Result;
|
||||
import org.eclipse.jgit.lib.StoredConfig;
|
||||
import org.kohsuke.args4j.Option;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -139,6 +141,11 @@ final class CreateProject extends BaseCommand {
|
||||
try {
|
||||
repo.create(true);
|
||||
|
||||
StoredConfig config = repo.getConfig();
|
||||
config.setBoolean(ConfigConstants.CONFIG_CORE_SECTION,
|
||||
null, ConfigConstants.CONFIG_KEY_LOGALLREFUPDATES, true);
|
||||
config.save();
|
||||
|
||||
RefUpdate u = repo.updateRef(Constants.HEAD);
|
||||
u.disableRefLog();
|
||||
u.link(branch);
|
||||
|
Loading…
Reference in New Issue
Block a user