Deleted Added
full compact
recurse.c (30337) recurse.c (32788)
1/*
2 * Copyright (c) 1992, Brian Berliner and Jeff Polk
3 *
4 * You may distribute under the terms of the GNU General Public License as
1/*
2 * Copyright (c) 1992, Brian Berliner and Jeff Polk
3 *
4 * You may distribute under the terms of the GNU General Public License as
5 * specified in the README file that comes with the CVS 1.4 kit.
5 * specified in the README file that comes with the CVS source distribution.
6 *
7 * General recursion handler
8 *
9 */
10
11#include "cvs.h"
12#include "savecwd.h"
13#include "fileattr.h"

--- 138 unchanged lines hidden (view full) ---

152 /*
153 * There were no arguments, so we'll probably just recurse. The
154 * exception to the rule is when we are called from a directory
155 * without any CVS administration files. That has always meant to
156 * process each of the sub-directories, so we pretend like we were
157 * called with the list of sub-dirs of the current dir as args
158 */
159 if ((which & W_LOCAL) && !isdir (CVSADM))
6 *
7 * General recursion handler
8 *
9 */
10
11#include "cvs.h"
12#include "savecwd.h"
13#include "fileattr.h"

--- 138 unchanged lines hidden (view full) ---

152 /*
153 * There were no arguments, so we'll probably just recurse. The
154 * exception to the rule is when we are called from a directory
155 * without any CVS administration files. That has always meant to
156 * process each of the sub-directories, so we pretend like we were
157 * called with the list of sub-dirs of the current dir as args
158 */
159 if ((which & W_LOCAL) && !isdir (CVSADM))
160 {
160 dirlist = Find_Directories ((char *) NULL, W_LOCAL, (List *) NULL);
161 dirlist = Find_Directories ((char *) NULL, W_LOCAL, (List *) NULL);
162 /* If there are no sub-directories, there is a certain logic in
163 favor of doing nothing, but in fact probably the user is just
164 confused about what directory they are in, or whether they
165 cvs add'd a new directory. In the case of at least one
166 sub-directory, at least when we recurse into them we
167 notice (hopefully) whether they are under CVS control. */
168 if (list_isempty (dirlist))
169 {
170 if (update_dir[0] == '\0')
171 error (0, 0, "in directory .:");
172 else
173 error (0, 0, "in directory %s:", update_dir);
174 error (1, 0,
175 "there is no version here; run '%s checkout' first",
176 program_name);
177 }
178 }
161 else
162 addlist (&dirlist, ".");
163
164 err += do_recursion (&frame);
165 goto out;
166 }
167
168

--- 463 unchanged lines hidden (view full) ---

632 * used is in the case where we are creating a new sub-directory for
633 * update -d and in that case the generated name will be correct.
634 */
635 if (repository == NULL)
636 newrepos = xstrdup ("");
637 else
638 {
639 newrepos = xmalloc (strlen (repository) + strlen (dir) + 5);
179 else
180 addlist (&dirlist, ".");
181
182 err += do_recursion (&frame);
183 goto out;
184 }
185
186

--- 463 unchanged lines hidden (view full) ---

650 * used is in the case where we are creating a new sub-directory for
651 * update -d and in that case the generated name will be correct.
652 */
653 if (repository == NULL)
654 newrepos = xstrdup ("");
655 else
656 {
657 newrepos = xmalloc (strlen (repository) + strlen (dir) + 5);
640 (void) sprintf (newrepos, "%s/%s", repository, dir);
658 sprintf (newrepos, "%s/%s", repository, dir);
641 }
642 }
643 else
644 {
645 if (update_dir[0] == '\0')
646 (void) strcpy (update_dir, dir);
647
648 if (repository == NULL)
649 newrepos = xstrdup ("");
650 else
651 newrepos = xstrdup (repository);
652 }
653
659 }
660 }
661 else
662 {
663 if (update_dir[0] == '\0')
664 (void) strcpy (update_dir, dir);
665
666 if (repository == NULL)
667 newrepos = xstrdup ("");
668 else
669 newrepos = xstrdup (repository);
670 }
671
672 /* Check to see that the CVSADM directory, if it exists, seems to be
673 well-formed. It can be missing files if the user hit ^C in the
674 middle of a previous run. We want to (a) make this a nonfatal
675 error, and (b) make sure we print which directory has the
676 problem.
677
678 Do this before the direntproc, so that (1) the direntproc
679 doesn't have to guess/deduce whether we will skip the directory
680 (e.g. send_dirent_proc and whether to send the directory), and
681 (2) so that the warm fuzzy doesn't get printed if we skip the
682 directory. */
683 if (frame->which & W_LOCAL)
684 {
685 char *cvsadmdir;
686
687 cvsadmdir = xmalloc (strlen (dir)
688 + sizeof (CVSADM_REP)
689 + sizeof (CVSADM_ENT)
690 + 80);
691
692 strcpy (cvsadmdir, dir);
693 strcat (cvsadmdir, "/");
694 strcat (cvsadmdir, CVSADM);
695 if (isdir (cvsadmdir))
696 {
697 strcpy (cvsadmdir, dir);
698 strcat (cvsadmdir, "/");
699 strcat (cvsadmdir, CVSADM_REP);
700 if (!isfile (cvsadmdir))
701 {
702 /* Some commands like update may have printed "? foo" but
703 if we were planning to recurse, and don't on account of
704 CVS/Repository, we want to say why. */
705 error (0, 0, "ignoring %s (%s missing)", update_dir,
706 CVSADM_REP);
707 dir_return = R_SKIP_ALL;
708 }
709
710 /* Likewise for CVS/Entries. */
711 if (dir_return != R_SKIP_ALL)
712 {
713 strcpy (cvsadmdir, dir);
714 strcat (cvsadmdir, "/");
715 strcat (cvsadmdir, CVSADM_ENT);
716 if (!isfile (cvsadmdir))
717 {
718 /* Some commands like update may have printed "? foo" but
719 if we were planning to recurse, and don't on account of
720 CVS/Repository, we want to say why. */
721 error (0, 0, "ignoring %s (%s missing)", update_dir,
722 CVSADM_ENT);
723 dir_return = R_SKIP_ALL;
724 }
725 }
726 }
727 free (cvsadmdir);
728 }
729
654 /* call-back dir entry proc (if any) */
730 /* call-back dir entry proc (if any) */
655 if (frame->direntproc != NULL)
731 if (dir_return == R_SKIP_ALL)
732 ;
733 else if (frame->direntproc != NULL)
656 dir_return = frame->direntproc (frame->callerdat, dir, newrepos,
657 update_dir, frent->entries);
734 dir_return = frame->direntproc (frame->callerdat, dir, newrepos,
735 update_dir, frent->entries);
736 else
737 {
738 /* Generic behavior. I don't see a reason to make the caller specify
739 a direntproc just to get this. */
740 if ((frame->which & W_LOCAL) && !isdir (dir))
741 dir_return = R_SKIP_ALL;
742 }
743
658 free (newrepos);
659
660 /* only process the dir if the return code was 0 */
661 if (dir_return != R_SKIP_ALL)
662 {
663 /* save our current directory and static vars */
664 if (save_cwd (&cwd))
665 error_exit ();

--- 165 unchanged lines hidden ---
744 free (newrepos);
745
746 /* only process the dir if the return code was 0 */
747 if (dir_return != R_SKIP_ALL)
748 {
749 /* save our current directory and static vars */
750 if (save_cwd (&cwd))
751 error_exit ();

--- 165 unchanged lines hidden ---