#!/bin/bash # # svnemptydir.sh - helper app for listing empty directories in svn # Copyright (C) 2008 Clifford Wolf # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. x1=`mktemp` x2=`mktemp` x3=`mktemp` x4=`mktemp` x5=`mktemp` trap 'rm -f $x1 $x2 $x3 $x4 $x5' 0 svn st --no-ignore "$@" | grep '^[?ID]' | cut -c8- | sed 's,^ *,,' > $x1 find "$@" \! -wholename '*/.svn/*' \! -wholename '*/.svn' -type f | sed 's,^./,,' > $x2 find "$@" \! -wholename '*/.svn/*' \! -wholename '*/.svn' -type d | sed 's,^./,,' > $x3 svn_ignore_del_merge() { gawk ' function add(filename) { testfn = filename "/"; while (gsub("/[^/]*$", "", testfn)) { if (ignore[testfn]) return; } files[filename] = 1; } ARGIND == 1 { ignore[$0] = 1; } ARGIND == 2 { sub("/*$", ""); add($0); } END { for (f in files) print f; } ' $1 $2 | sort } svn_ignore_del_merge $x1 $x2 > $x4 svn_ignore_del_merge $x1 $x3 > $x5 gawk ' BEGIN { dir_used["."] = 1; } ARGIND == 1 { n = split($0, dir_elements, "/"); current_dir = dir_elements[1]; for (i=1; i