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

Fix branch ancestry calculation

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

Some branches don't get any ancestors at all, because their ancestor gets a "dotcount" value of 0, and are thus not considered any better than not having any ancestor. That's obviously wrong. Even a zero-dot-count ancestor is better than having none at all.

This fixes the issue by making not having an ancestor branch have a goodness value of -1, avoiding the problem (because even a zero dot-count will be considered better).

Alternatively, the special-case for the "1.1.1.1" revision should be removed (or made to imply a dot-count of 1).

Finally, I suspect that dot-counting in general should ignore any final ".1" counts, ie "1.2.1.1" should count the same as "1.2.1", which should count the same as "1.2", which has a dot-count of 1.

That would automatically make any "1.1.1.1.1...." sequence always count as having a dot-count of 0.

I'll send suggestion that as a separate patch, but in the meantime, this is a separate issue, and obviously a bug-fix.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
----
diff --git a/cvsps.c b/cvsps.c
--- a/cvsps.c
+++ b/cvsps.c
@@ -2599,7 +2599,7 @@ static void determine_branch_ancestor(Pa
 	 * note: rev is the pre-commit revision, not the post-commit
 	 */
 	if (!head_ps->ancestor_branch)
-	    d1 = 0;
+	    d1 = -1;
 	else if (strcmp(ps->branch, rev->branch) == 0)
 	    continue;
 	else if (strcmp(head_ps->ancestor_branch, "HEAD") == 0)
Next: Linus Torvalds
Message 1 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.