Use Constants.EMPTY_TREE_ID from JGit
Change-Id: Id0e806865a60daaeb1ce9852f2ae4e873978054c
This commit is contained in:
committed by
David Pursehouse
parent
b4b7c82382
commit
1c8de10423
@@ -16,6 +16,7 @@ package com.google.gerrit.gpg;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.eclipse.jgit.lib.Constants.EMPTY_TREE_ID;
|
||||
import static org.eclipse.jgit.lib.Constants.OBJ_BLOB;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
@@ -75,10 +76,6 @@ import org.eclipse.jgit.util.NB;
|
||||
* after checking with a {@link PublicKeyChecker}.
|
||||
*/
|
||||
public class PublicKeyStore implements AutoCloseable {
|
||||
|
||||
private static final ObjectId EMPTY_TREE =
|
||||
ObjectId.fromString("4b825dc642cb6eb9a060e54bf8d69288fbee4904");
|
||||
|
||||
/** Ref where GPG public keys are stored. */
|
||||
public static final String REFS_GPG_KEYS = "refs/meta/gpg-keys";
|
||||
|
||||
@@ -361,7 +358,7 @@ public class PublicKeyStore implements AutoCloseable {
|
||||
deleteFromNotes(ins, fp);
|
||||
}
|
||||
cb.setTreeId(notes.writeTree(ins));
|
||||
if (cb.getTreeId().equals(tip != null ? tip.getTree() : EMPTY_TREE)) {
|
||||
if (cb.getTreeId().equals(tip != null ? tip.getTree() : EMPTY_TREE_ID)) {
|
||||
return RefUpdate.Result.NO_CHANGE;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import static com.google.gerrit.testing.GerritJUnit.assertThrows;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static org.eclipse.jgit.lib.Constants.EMPTY_TREE_ID;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -1089,9 +1090,7 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
|
||||
.create(admin.newIdent(), testRepo, "Change 1", ImmutableMap.of())
|
||||
.to("refs/for/master");
|
||||
change.assertOkStatus();
|
||||
// TODO(dborowitz): Use EMPTY_TREE_ID after upgrading to https://git.eclipse.org/r/127473
|
||||
assertThat(change.getCommit().getTree())
|
||||
.isEqualTo(ObjectId.fromString("4b825dc642cb6eb9a060e54bf8d69288fbee4904"));
|
||||
assertThat(change.getCommit().getTree()).isEqualTo(EMPTY_TREE_ID);
|
||||
|
||||
Map<BranchNameKey, ObjectId> actual = fetchFromSubmitPreview(change.getChangeId());
|
||||
assertThat(projectOperations.project(project).hasHead("master")).isFalse();
|
||||
|
||||
Reference in New Issue
Block a user