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:
Matthias Sohn 2011-03-09 16:45:06 +01:00
parent fdaa54f7fe
commit 0ff5ff0112
1 changed files with 7 additions and 0 deletions

View File

@ -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);