remove .metadata first so .etckeeper doesn't try to chmod it
authorJoey Hess <joey@kodama.kitenet.net>
Fri, 21 Mar 2008 02:50:51 +0000 (22:50 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Fri, 21 Mar 2008 02:50:51 +0000 (22:50 -0400)
Also, remove vcs test, as it's in a code block that already tests that.

pre-commit.d/30store-metadata

index e5dcd77661ac779c5b54950be965b8e4f6a0d0c7..ec0c69148872f10b2d6588ae45a9899837b563e1 100755 (executable)
@@ -54,6 +54,11 @@ generate_metadata() {
 
 
 if [ "$VCS" = git ] || [ "$VCS" = hg ] || [ "$VCS" = bzr ]; then
+       if [ -f .metadata ]; then
+               # remove obsolete .metadata file
+               $VCS rm .metadata
+       fi
+
        echo "# Generated by etckeeper.  Do not edit." > .etckeeper
        echo >> .etckeeper
 
@@ -70,9 +75,4 @@ if [ "$VCS" = git ] || [ "$VCS" = hg ] || [ "$VCS" = bzr ]; then
        fi
        # hg and bzr add not done, they will automatically
        # include the file in the current commit
-
-       # Finally, VCS remove obsolete .metadata (as long as VCS is set)
-       if [ -f .metadata ] && [ "x$VCS" != "x" ]; then
-               $VCS rm .metadata
-       fi
 fi