From: Linus Torvalds <torvalds@osdl.org>
To: David Mansfield <cvsps@dm.cobite.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: [RFC] Make dot-counting ignore ".1" at the end
Date: Wed, 22 Mar 2006 17:50:23 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0603221746300.26286@g5.osdl.org> (raw)
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;
next prev parent reply other threads:[~2006-03-23 1:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-23 1:29 Fix branch ancestry calculation Linus Torvalds
2006-03-23 1:50 ` Linus Torvalds [this message]
2006-03-23 6:26 ` [RFC] Make dot-counting ignore ".1" at the end Keith Packard
2006-03-23 6:34 ` Linus Torvalds
2006-03-23 7:17 ` Keith Packard
2006-03-24 14:40 ` David Mansfield
2006-03-24 14:45 ` Fix branch ancestry calculation David Mansfield
2006-03-24 15:46 ` Linus Torvalds
2006-03-24 16:38 ` Keith Packard
2006-03-25 1:45 ` Chris Shoemaker
2006-03-25 7:54 ` Keith Packard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0603221746300.26286@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=cvsps@dm.cobite.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).