diff -r 6f3428c528b4 -r 66da6e9feacd mercurial/pathencode.c --- a/mercurial/pathencode.c Thu Jun 20 14:06:11 2013 -0500 +++ b/mercurial/pathencode.c Wed Jun 19 22:34:34 2013 -0700 @@ -585,7 +585,8 @@ in a space or dot, which are unportable. */ if (d == '.' || d == ' ') dest[destlen - 1] = '_'; - if (destlen > maxshortdirslen) + /* The + 3 is to account for "dh/" in the beginning */ + if (destlen > maxshortdirslen + 3) break; charcopy(dest, &destlen, destsize, src[i]); p = -1;