From 308b60f66831aa65a459a7b347ea6ca14b6e4799 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 18 Mar 1999 09:21:42 +0000 Subject: Import cvs-1.10 onto vendor branch. Merge to follow shortly. Obtained from: cyclic.com --- contrib/cvs/src/add.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) (limited to 'contrib/cvs/src/add.c') diff --git a/contrib/cvs/src/add.c b/contrib/cvs/src/add.c index d44435a..a4eed40 100644 --- a/contrib/cvs/src/add.c +++ b/contrib/cvs/src/add.c @@ -56,6 +56,9 @@ add (argc, argv) List *entries; Vers_TS *vers; struct saved_cwd cwd; + /* Nonzero if we found a slash, and are thus adding files in a + subdirectory. */ + int found_slash = 0; if (argc == 1 || argc == -1) usage (add_usage); @@ -108,6 +111,20 @@ add (argc, argv) error (0, 0, "cannot add special file `%s'; skipping", argv[i]); skip_file = 1; } + else + { + char *p; + p = argv[i]; + while (*p != '\0') + { + if (ISDIRSEP (*p)) + { + found_slash = 1; + break; + } + ++p; + } + } if (skip_file) { @@ -143,9 +160,16 @@ add (argc, argv) if (options) send_arg(options); option_with_arg ("-m", message); - repository = Name_Repository (NULL, NULL); - send_a_repository ("", repository, ""); - free (repository); + /* If !found_slash, refrain from sending "Directory", for + CVS 1.9 compatibility. If we only tried to deal with servers + which are at least CVS 1.9.26 or so, we wouldn't have to + special-case this. */ + if (found_slash) + { + repository = Name_Repository (NULL, NULL); + send_a_repository ("", repository, ""); + free (repository); + } for (i = 0; i < argc; ++i) /* FIXME: Does this erroneously call Create_Admin in error @@ -194,7 +218,8 @@ add (argc, argv) Create_Admin (p, argv[i], rcsdir, tag, date, nonbranch, 0); - send_a_repository ("", repository, update_dir); + if (found_slash) + send_a_repository ("", repository, update_dir); if (restore_cwd (&cwd, NULL)) error_exit (); -- cgit v1.1