diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2009-03-21 11:16:29 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2009-03-21 11:16:29 +0000 |
commit | 205fc64a14ebed6242d0affa583e66ccff49cd03 (patch) | |
tree | 2aeddd1258104baefdc0464037007537703b30ac | |
parent | 3ebe8a8261e3543c489e2713d9c5e248214cd5b9 (diff) |
be smarter when checking if a directory is empty by looking at
CVS/Entries early on in cvs_update_leavedir()
-rw-r--r-- | usr.bin/cvs/update.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c index b4cf0f98c84..684e478cf3c 100644 --- a/usr.bin/cvs/update.c +++ b/usr.bin/cvs/update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: update.c,v 1.157 2009/02/21 14:50:53 joris Exp $ */ +/* $OpenBSD: update.c,v 1.158 2009/03/21 11:16:28 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -246,6 +246,12 @@ cvs_update_leavedir(struct cvs_file *cf) if (cvs_server_active == 1 && !strcmp(cf->file_name, ".")) return; + entlist = cvs_ent_open(cf->file_path); + if (!TAILQ_EMPTY(&(entlist->cef_ent))) { + isempty = 0; + goto prune_it; + } + if (fstat(cf->fd, &st) == -1) fatal("cvs_update_leavedir: %s", strerror(errno)); @@ -276,13 +282,8 @@ cvs_update_leavedir(struct cvs_file *cf) continue; } - if (!strcmp(dp->d_name, CVS_PATH_CVSDIR)) { - entlist = cvs_ent_open(cf->file_path); - if (!TAILQ_EMPTY(&(entlist->cef_ent))) - isempty = 0; - } else { + if (strcmp(dp->d_name, CVS_PATH_CVSDIR)) isempty = 0; - } if (isempty == 0) break; @@ -296,6 +297,7 @@ cvs_update_leavedir(struct cvs_file *cf) xfree(buf); +prune_it: if ((isempty == 1 && prune_dirs == 1) || (cvs_server_active == 1 && cvs_cmdop == CVS_OP_CHECKOUT)) { /* XXX */ |