=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/rcsnum.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- src/usr.bin/cvs/rcsnum.c 2008/03/01 20:03:56 1.52 +++ src/usr.bin/cvs/rcsnum.c 2008/05/22 07:03:02 1.53 @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsnum.c,v 1.52 2008/03/01 20:03:56 joris Exp $ */ +/* $OpenBSD: rcsnum.c,v 1.53 2008/05/22 07:03:02 joris Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -180,8 +180,9 @@ * Compare the two numbers and . Returns -1 if is larger than * , 0 if they are both the same, and 1 if is larger than . * The argument specifies how many numbers deep should be checked for - * the result. A value of 0 means that the depth will be the minimum of the - * two numbers. + * the result. A value of 0 means that the depth will be the maximum of the + * two numbers, so that a longer number is considered greater than a shorter + * number if they are equal up to the minimum length. */ int rcsnum_cmp(RCSNUM *n1, RCSNUM *n2, u_int depth) @@ -205,7 +206,12 @@ return (-1); } - if (n1->rn_len > n2->rn_len) + /* If an explicit depth was specified, and we've + * already checked up to depth, consider the + * revision numbers equal. */ + if (depth != 0 && slen == depth) + return (0); + else if (n1->rn_len > n2->rn_len) return (-1); else if (n2->rn_len > n1->rn_len) return (1);