aboutsummaryrefslogtreecommitdiff
path: root/trunk/lib
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2008-11-28 13:15:37 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2008-11-28 13:15:37 +0000
commitdb554f74159f496109c356f49092045d62423404 (patch)
tree0e9387222904608b8356a39f817b5c2a64ea4517 /trunk/lib
parent2c42b157c23c605a771e2a0583882905e8a7a708 (diff)
downloadsimplepkg-db554f74159f496109c356f49092045d62423404.tar.gz
simplepkg-db554f74159f496109c356f49092045d62423404.tar.bz2
better svn_remove_empty_folders algorithm
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@591 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk/lib')
-rw-r--r--trunk/lib/common.sh23
1 files changed, 5 insertions, 18 deletions
diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh
index e755bd1..0d8738e 100644
--- a/trunk/lib/common.sh
+++ b/trunk/lib/common.sh
@@ -673,28 +673,15 @@ function chgrp_svn {
function svn_remove_empty_folders {
- if [ -z "$1" ]; then
+ if [ -z "$1" ] && [ ! -d "$1" ]; then
return 1
fi
- local main_folder search results
-
- main_folder="$1"
- search="`find $main_folder -type d | grep -v '/.svn' | sed '1d'`"
- results="`echo "$search" | wc -w`" # folders can't have space, slackware compliance
-
- if [ "$results" -eq "0" ]; then
- if [ "`find $main_folder -not -type d | wc -l`" -eq "0" ]; then
- svn_del $main_folder
+ for folder in `find $1 -type d -print | grep -v "/\.svn"`; do
+ if [ "`ls -A -1 $folder | grep -v .svn | wc -l`" -eq "0" ]; then
+ svn_del $folder
fi
- else
- for folder in $search; do
- # can be deleted already
- if [ -d "$folder" ]; then
- svn_remove_empty_folders $folder
- fi
- done
- fi
+ done
}