[RFC] Make dot-counting ignore ".1" at the end

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm not 100% sure this is appropriate, but in general, I think "<rev>" and 
"<rev>.1" should be considered the same thing, no? Which implies that 
"1.1" and "1.1.1.1" are all the same thing, and collapse to just "1", ie a 
zero dot-count. They are all the same version, after all, no?

This gets rid of the insane (?) special case of "1.1.1.1" that exists 
there now, since it's now no longer a special case.

I also wonder if trailing ".1" revisions should be ignored when comparing 
two revisions.

Signed-off-by: Linus Torvalds <torvalds@xxxxxxxx>
---

Yeah, I don't know RCS file logic. This may be completely broken.

diff --git a/cvsps.c b/cvsps.c
index 2695a0f..2ad1595 100644
--- a/cvsps.c
+++ b/cvsps.c
@@ -2357,9 +2357,16 @@ static int revision_affects_branch(CvsFi
 static int count_dots(const char * p)
 {
     int dots = 0;
+    int len = strlen(p);
 
-    while (*p)
-	if (*p++ == '.')
+    while (len > 2) {
+	if (memcmp(p+len-2, ".1", 2))
+		break;
+	len -= 2;
+    }
+
+    while (len)
+	if (p[--len] == '.')
 	    dots++;
 
     return dots;
@@ -2613,7 +2620,7 @@ static void determine_branch_ancestor(Pa
 	/* HACK: we sometimes pretend to derive from the import branch.  
 	 * just don't do that.  this is the easiest way to prevent... 
 	 */
-	d2 = (strcmp(rev->rev, "1.1.1.1") == 0) ? 0 : count_dots(rev->rev);
+	d2 = count_dots(rev->rev);
 	
 	if (d2 > d1)
 	    head_ps->ancestor_branch = rev->branch;
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]