git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Linus Torvalds <torvalds@osdl.org>
Date
Mar 23, 2006, 01:50 UTC
Message-ID
<Pine.LNX.4.64.0603221746300.26286@g5.osdl.org>
In-Reply-To
<Pine.LNX.4.64.0603221723230.9196@g5.osdl.org>

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@osdl.org>
---
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;
Previous: Linus TorvaldsNext: Keith Packard
Message 2 of 11 in “Fix branch ancestry calculation”
  1. Linus TorvaldsMar 23, 2006
  2. [RFC] Make dot-counting ignore ".1" at the endLinus Torvalds, Mar 23, 2006
  3. Keith PackardMar 23, 2006
  4. Linus TorvaldsMar 23, 2006
  5. Keith PackardMar 23, 2006
  6. David MansfieldMar 24, 2006
  7. David MansfieldMar 24, 2006
  8. Linus TorvaldsMar 24, 2006
  9. Keith PackardMar 24, 2006
  10. Chris ShoemakerMar 25, 2006
  11. Keith PackardMar 25, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.