find has a bug where pruned directories are considered empty, even if they're not.
authorScott Bronson <b.git@u32.net>
Thu, 20 Mar 2008 09:44:12 +0000 (02:44 -0700)
committerScott Bronson <b.git@u32.net>
Thu, 20 Mar 2008 09:44:12 +0000 (02:44 -0700)
Therefore we'll revert to the previous empty directory finding code.
The previous code would let "mkdir -p './.git'" into .etckeeper (no big deal but still wrong).

pre-commit.d/30store-metadata

index 93e12020ed46ca09f6dfd45d13643f082c8aff1e..e5dcd77661ac779c5b54950be965b8e4f6a0d0c7 100755 (executable)
@@ -28,8 +28,8 @@ generate_metadata() {
        if [ "$VCS" = git ] || [ "$VCS" = hg ]; then
                # These version control systems do not track directories,
                # so empty directories must be stored specially.
-               find $NOVCS -type d -empty | sort | \
-                       sed -e "s/^/mkdir -p '/" -e "s/\$/'/"
+               find -type d -empty | grep -v /.git/ | grep -v /.hg/ | grep -v /.bzr/ |
+                       sort | sed -e "s/^/mkdir -p '/" -e "s/\$/'/"
        fi
 
        # Find all files and directories that don't have root as the owner