changeset 17692:fb458b3e72fc

pathencode: skip encoding if input is already longer than maxstorepathlen Calling basicencode may make the path longer, never shorter. If it's already too long before, then we don't even need to basicencode it.
author Adrian Buehlmann <adrian@cadifra.com>
date Sun, 30 Sep 2012 23:53:56 +0200
parents c6c7e466dd3a
children 0c6de45e1212
files mercurial/pathencode.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/pathencode.c	Sun Sep 30 23:53:56 2012 +0200
+++ b/mercurial/pathencode.c	Sun Sep 30 23:53:56 2012 +0200
@@ -501,6 +501,12 @@
 		return NULL;
 	}
 
+	if (len > maxstorepathlen) {
+		newobj = Py_None;
+		Py_INCREF(newobj);
+		return newobj;
+	}
+
 	newlen = len ? basicencode(NULL, 0, path, len + 1) : 1;
 
 	if (newlen <= maxstorepathlen + 1) {