summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2010-10-15 08:46:24 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2010-10-15 08:46:24 +0000
commitd2791bf27ffec17cc0b5fd5a0dc360ed293daea5 (patch)
tree3a0342ede62b5662d81338f90795c1dd10f27229 /usr.bin
parentce3620dabc66a20fd61e167be9dc1b1ed110f626 (diff)
Fixed default branch handling and added support for branches in branches.
ok nicm
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/rcs.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index bd052f5303b..cf497afb73c 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.303 2010/10/15 08:44:12 tobias Exp $ */
+/* $OpenBSD: rcs.c,v 1.304 2010/10/15 08:46:23 tobias Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -452,17 +452,23 @@ rcs_head_get(RCSFILE *file)
/* we have a default branch, use that to calculate the
* real HEAD*/
rootrev = rcsnum_alloc();
- rcsnum_cpy(file->rf_branch, rootrev, 2);
+ rcsnum_cpy(file->rf_branch, rootrev,
+ file->rf_branch->rn_len - 1);
if ((rdp = rcs_findrev(file, rootrev)) == NULL)
fatal("rcs_head_get: could not find root revision");
/* HEAD should be the last revision on the default branch */
TAILQ_FOREACH(brp, &(rdp->rd_branches), rb_list) {
- if (TAILQ_NEXT(brp, rb_list) == NULL)
+ if (rcsnum_cmp(brp->rb_num, file->rf_branch,
+ file->rf_branch->rn_len) == NULL)
break;
}
rcsnum_free(rootrev);
+ if (brp == NULL)
+ fatal("rcs_head_get: could not find first default "
+ "branch revision");
+
if ((rdp = rcs_findrev(file, brp->rb_num)) == NULL)
fatal("rcs_head_get: could not find branch revision");
while (rdp->rd_next->rn_len != 0)