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

login
register
mail settings
Submitter phabricator
Date Aug. 5, 2018, 1:04 p.m.
Message ID <9766b9aff5a10c4930beeae8155eb8ca@localhost.localdomain>
Download mbox | patch
Permalink /patch/33266/
State Not Applicable
Headers show

Comments

phabricator - Aug. 5, 2018, 1:04 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4c0fd3f0a15d: index: drop support for nullid at position len(index) in index_node (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4105?vs=9908&id=9929

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

AFFECTED FILES
  mercurial/cext/revlog.c

CHANGE DETAILS




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

Patch

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) {