D4105: index: drop support for nullid at position len(index) in index_node

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sun Aug 5 06:33:56 UTC 2018


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I think no callers exist since at least https://phab.mercurial-scm.org/rHGa3dacabd476b6bed04932b08962d7aa2fd2fad41 (index: don't
  allow index[len(index)] to mean nullid, 2018-07-20).

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4105

AFFECTED FILES
  mercurial/cext/revlog.c

CHANGE DETAILS

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -228,10 +228,10 @@
 	Py_ssize_t length = index_length(self) + 1;
 	const char *data;
 
-	if (pos == length - 1 || pos == -1)
+	if (pos == -1)
 		return nullid;
 
-	if (pos >= length)
+	if (pos >= length - 1)
 		return NULL;
 
 	if (pos >= self->length - 1) {



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list