diff options
author | 2010-10-15 08:46:23 +0000 | |
---|---|---|
committer | 2010-10-15 08:46:23 +0000 | |
commit | 18258a851a26bd3cadfc78e0ef6a75b4d9630d4a (patch) | |
tree | c07fc9facd729818e8a6ffde02eb76549ee19287 | |
parent | Replaced RCS parser code with new rcsparse.{c,h}: (diff) | |
download | wireguard-openbsd-18258a851a26bd3cadfc78e0ef6a75b4d9630d4a.tar.xz wireguard-openbsd-18258a851a26bd3cadfc78e0ef6a75b4d9630d4a.zip |
Fixed default branch handling and added support for branches in branches.
ok nicm
-rw-r--r-- | usr.bin/cvs/rcs.c | 12 |
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) |