diff --git a/hgitaly/service/commit.py b/hgitaly/service/commit.py index 3c6b018d3924495530554ac84edf69a509b37915_aGdpdGFseS9zZXJ2aWNlL2NvbW1pdC5weQ==..744ee924c13554a6b5bd815b624aeafe5b22208e_aGdpdGFseS9zZXJ2aWNlL2NvbW1pdC5weQ== 100644 --- a/hgitaly/service/commit.py +++ b/hgitaly/service/commit.py @@ -112,6 +112,7 @@ base_logger = logging.getLogger(__name__) +NULL_REV = nodemod.nullrev PSEUDO_REVS = (nodemod.wdirrev, nodemod.nullrev) PSEUDO_REVLOG_NODES = { nodemod.nullid, @@ -494,6 +495,9 @@ revision) return FindCommitResponse() + if ctx.rev() == NULL_REV: + return FindCommitResponse() + commit = message.commit(ctx) return FindCommitResponse(commit=commit) diff --git a/hgitaly/service/tests/test_commit.py b/hgitaly/service/tests/test_commit.py index 3c6b018d3924495530554ac84edf69a509b37915_aGdpdGFseS9zZXJ2aWNlL3Rlc3RzL3Rlc3RfY29tbWl0LnB5..744ee924c13554a6b5bd815b624aeafe5b22208e_aGdpdGFseS9zZXJ2aWNlL3Rlc3RzL3Rlc3RfY29tbWl0LnB5 100644 --- a/hgitaly/service/tests/test_commit.py +++ b/hgitaly/service/tests/test_commit.py @@ -269,6 +269,9 @@ assert not find_commit(b'f' * 39).HasField('commit') assert not find_commit(b'f' * 40).HasField('commit') + # null revision + assert not find_commit(b'0' * 40).HasField('commit') + def test_find_commits(commit_fixture_empty_repo): fixture = commit_fixture_empty_repo diff --git a/tests_with_gitaly/test_commit.py b/tests_with_gitaly/test_commit.py index 3c6b018d3924495530554ac84edf69a509b37915_dGVzdHNfd2l0aF9naXRhbHkvdGVzdF9jb21taXQucHk=..744ee924c13554a6b5bd815b624aeafe5b22208e_dGVzdHNfd2l0aF9naXRhbHkvdGVzdF9jb21taXQucHk= 100644 --- a/tests_with_gitaly/test_commit.py +++ b/tests_with_gitaly/test_commit.py @@ -225,6 +225,7 @@ mr_ref_path, _ = fixture.write_special_ref(b'merge-requests/2/train', ctx1.hex()) + assert_compare(revision=b"0000" * 10) assert_compare(revision=ctx0.hex()) assert_compare(revision=b'branch/default') assert_compare(revision=b'refs/heads/branch/default')