diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-05-20 18:14:37 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-05-20 18:14:37 +0000 |
commit | 5f0967c0bc424978682979df01a6955ddc36040b (patch) | |
tree | ff5abe020d642a6ab85d50bf28b47cdfdce22967 /gnu | |
parent | 7f2bf703d949bccf70aab2813472a15de3724767 (diff) |
Checking out in dirs having the repository as its prefix was sometimes
wrongly thought as checking out into the repository. E.g. checking
out in /cvs.g/hack/foo with CVSROOT set to /cvs was impossible.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/cvs/src/checkout.c | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/gnu/usr.bin/cvs/src/checkout.c b/gnu/usr.bin/cvs/src/checkout.c index 422cfeeb75f..c5874645f0e 100644 --- a/gnu/usr.bin/cvs/src/checkout.c +++ b/gnu/usr.bin/cvs/src/checkout.c @@ -35,11 +35,6 @@ #include "cvs.h" -#ifndef lint -static const char rcsid[] = "$CVSid: @(#)checkout.c 1.78 94/10/07 $"; -USE(rcsid); -#endif - static char *findslash PROTO((char *start, char *p)); static int build_dirs_and_chdir PROTO((char *dir, char *prepath, char *realdir, int sticky)); @@ -89,6 +84,7 @@ static int pipeout; static int aflag; static char *options = NULL; static char *tag = NULL; +static int tag_validated = 0; static char *date = NULL; static char *join_rev1 = NULL; static char *join_rev2 = NULL; @@ -324,15 +320,13 @@ checkout (argc, argv) client_nonexpanded_setup (); } - if (fprintf - (to_server, - strcmp (command_name, "export") == 0 ? "export\n" : "co\n") - < 0) - error (1, errno, "writing to server"); + send_to_server (strcmp (command_name, "export") == 0 ? + "export\012" : "co\012", + 0); return get_responses_and_close (); } -#endif +#endif /* CLIENT_SUPPORT */ if (cat || status) { @@ -360,7 +354,12 @@ checkout (argc, argv) (void) sprintf (repository, "%s/%s/%s", CVSroot, CVSROOTADM, CVSNULLREPOS); if (!isfile (repository)) + { + mode_t omask; + omask = umask (cvsumask); (void) CVS_MKDIR (repository, 0777); + (void) umask (omask); + } /* I'm not sure whether this check is redundant. */ if (!isdir (repository)) @@ -420,6 +419,7 @@ safe_location () { char current[PATH_MAX]; char hardpath[PATH_MAX+5]; + int hardpathlen; int x; x = readlink(CVSroot, hardpath, sizeof hardpath - 1); @@ -427,9 +427,14 @@ safe_location () { strcpy(hardpath, CVSroot); } - hardpath[x] = '\0'; + else + { + hardpath[x] = '\0'; + } getwd (current); - if (strncmp(current, hardpath, strlen(hardpath)) == 0) + hardpathlen = strlen (hardpath); + if (strncmp(current, hardpath, hardpathlen) == 0 + && (current[hardpathlen] == '\0' || current[hardpathlen] == '/')) { return (0); } @@ -719,13 +724,29 @@ checkout_proc (pargc, argv, where, mwhere, mfile, shorten, return (1); } which = W_REPOS; + if (tag != NULL && !tag_validated) + { + tag_check_valid (tag, *pargc - 1, argv + 1, 0, aflag, NULL); + tag_validated = 1; + } } else + { which = W_LOCAL | W_REPOS; + if (tag != NULL && !tag_validated) + { + tag_check_valid (tag, *pargc - 1, argv + 1, 0, aflag, + repository); + tag_validated = 1; + } + } if (tag != NULL || date != NULL) which |= W_ATTIC; + /* FIXME: We don't call tag_check_valid on join_rev1 and join_rev2 + yet (make sure to handle ':' correctly if we do, though). */ + /* * if we are going to be recursive (building dirs), go ahead and call the * update recursion processor. We will be recursive unless either local @@ -755,19 +776,21 @@ checkout_proc (pargc, argv, where, mwhere, mfile, shorten, entries = Entries_Open (0); for (i = 1; i < *pargc; i++) { - char line[MAXLINELEN]; + char *line; char *user; Vers_TS *vers; user = argv[i]; vers = Version_TS (repository, options, tag, date, user, - force_tag_match, 0, entries, (List *) NULL); + force_tag_match, 0, entries, (RCSNode *) NULL); if (vers->ts_user == NULL) { + line = xmalloc (strlen (user) + 15); (void) sprintf (line, "Initial %s", user); Register (entries, user, vers->vn_rcs ? vers->vn_rcs : "0", line, vers->options, vers->tag, vers->date, (char *) 0); + free (line); } freevers_ts (&vers); } @@ -843,7 +866,7 @@ build_dirs_and_chdir (dir, prepath, realdir, sticky) /* I'm not sure whether this check is redundant. */ if (!isdir (repository)) error (1, 0, "there is no repository %s", repository); - Create_Admin (".", cp, repository, sticky ? (char *) NULL : tag, + Create_Admin (".", path, repository, sticky ? (char *) NULL : tag, sticky ? (char *) NULL : date); if (!noexec) { |