* Add tests for /etc/.git not yet existing and avoid doing bad things.
authorJoey Hess <joey@kodama.kitenet.net>
Wed, 14 Nov 2007 00:09:10 +0000 (19:09 -0500)
committerJoey Hess <joey@kodama.kitenet.net>
Wed, 14 Nov 2007 00:09:10 +0000 (19:09 -0500)
Closes: #451185
* If /etc/.git doesn't exist, display a suggestion to run etckeeper-init.

debian/changelog
post-apt.d/30git-add
post-apt.d/40git-rm
post-apt.d/50git-commit
pre-apt.d/50uncommitted-changes

index 22289d86cae2c822d7d2134db9bb20ed8df1ea36..3a923b582c5377df96bccfde16ca9fb660e4c58e 100644 (file)
@@ -2,8 +2,11 @@ etckeeper (0.2) UNRELEASED; urgency=low
 
   * Add .pwd.lock to default ignores, this file is created by programs
     that call getspent().
+  * Add tests for /etc/.git not yet existing and avoid doing bad things.
+    Closes: #451185
+  * If /etc/.git doesn't exist, display a suggestion to run etckeeper-init.
 
- -- Joey Hess <joeyh@debian.org>  Sun, 11 Nov 2007 14:41:40 -0500
+ -- Joey Hess <joeyh@debian.org>  Tue, 13 Nov 2007 19:07:14 -0500
 
 etckeeper (0.1) unstable; urgency=low
 
index 06504b44b07a0b8b1722260d098452234aa89dc2..79aa4068d26988482f5d949c0f973cb4659b7087 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/sh
 set -e
-if ! git-add .; then
-       echo "etckeeper warning: git-add failed" >&2
+if [ -d .git ]; then
+       if ! git-add .; then
+               echo "etckeeper warning: git-add failed" >&2
+       fi
 fi
index 4a474359ef8028df52ec4fe32b0b655de422c7cb..01161ca35e3a64d74f67e258940a1f70698dd36e 100755 (executable)
@@ -3,8 +3,10 @@ set -e
 
 TAB="  "
 
-for file in $(git ls-files --deleted); do
-       if [ ! -d "$file" ]; then 
-               git rm "$file"
-       fi
-done
+if [ -d .git ]; then
+       for file in $(git ls-files --deleted); do
+               if [ ! -d "$file" ]; then 
+                       git rm "$file"
+               fi
+       done
+fi
index 30ef0f20617532ca18c656e4d9dd3f5f10fe3b3a..6eb3434cbffcbb449b7a6f1ceffbce34afee7ce1 100755 (executable)
@@ -1,9 +1,12 @@
 #!/bin/sh
 set -e
 
-# TODO: figure out what packages were acted on by the apt run, and include
-# that info in the commit message
-message="committing changes after apt run"
+if [ -d .git ]; then
 
-# ignore exit code since it exits nonzero if there is nothing to do
-git commit -m "$message" || true
+       # TODO: figure out what packages were acted on by the apt run, and
+       # include that info in the commit message
+       message="committing changes after apt run"
+
+       # ignore exit code since it exits nonzero if there is nothing to do
+       git commit -m "$message" || true
+fi
index e394db127957e06eba6afcf83e7e736b7750d3b3..dd8db13c3ef23e2836bea980aa39f231df874fce 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 set -e
-if ! LANG=C git-status 2>&1 | grep -q "working directory clean"; then
+if [ -d .git ] && ! LANG=C git-status 2>&1 | grep -q "working directory clean"; then
        . /usr/share/debconf/confmodule
        db_capb escape
        db_title etckeeper