diff options
author | Joey Hess <joey@kitenet.net> | 2010-10-12 02:36:20 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-10-12 02:36:20 -0400 |
commit | 739337c857303388ac11d66d15323286393dd981 (patch) | |
tree | 66c92f6050772a64ef51bad06363ca490aebf93d | |
parent | 29a3d7f06b2a5a45169445d0c1d2c9326269d652 (diff) |
Do not warn about special files or hardlinks if they are ignored by git. Fixes #549354 for git, but not for other VCSs.
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | debian/preinst | 5 | ||||
-rw-r--r-- | etckeeper.spec | 2 | ||||
-rwxr-xr-x | pre-commit.d/20warn-hardlinks | 10 | ||||
-rwxr-xr-x | pre-commit.d/20warn-problem-files | 27 | ||||
-rwxr-xr-x | pre-commit.d/20warn-special-file | 12 |
6 files changed, 35 insertions, 23 deletions
diff --git a/debian/changelog b/debian/changelog index 12b2dc6..9578431 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ etckeeper (0.50) UNRELEASED; urgency=low * Add Danish translation of debconf templates. Closes: #597768 * Ignore /etc/.initctl. Closes: #598121 + * Do not warn about special files or hardlinks if they are ignored by + git. Fixes #549354 for git, but not for other VCSs. -- Joey Hess <joeyh@debian.org> Wed, 22 Sep 2010 17:45:57 -0400 diff --git a/debian/preinst b/debian/preinst index 11647a1..d7011d9 100644 --- a/debian/preinst +++ b/debian/preinst @@ -69,6 +69,11 @@ install|upgrade) rm_conffile etckeeper "/etc/etckeeper/commit.d/$c" done fi + if dpkg --compare-versions "$2" le "0.50"; then + for c in 20warn-hardlinks 20warn-special-file; do + rm_conffile etckeeper "/etc/etckeeper/pre-commit.d/$c" + done + fi # delete files the prerm stashes away to handle purging rm -rf /var/cache/etckeeper/stash diff --git a/etckeeper.spec b/etckeeper.spec index b4b609b..81b6842 100644 --- a/etckeeper.spec +++ b/etckeeper.spec @@ -1,5 +1,5 @@ Name: etckeeper -Version: 0.49 +Version: 0.50 Release: 4%{?dist} Summary: store /etc in git, mercurial, bzr or darcs diff --git a/pre-commit.d/20warn-hardlinks b/pre-commit.d/20warn-hardlinks deleted file mode 100755 index 54b3887..0000000 --- a/pre-commit.d/20warn-hardlinks +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -set -e - -if [ "$VCS" = git ] || [ "$VCS" = hg ] || [ "$VCS" = bzr ] || [ "$VCS" = darcs ]; then - hardlinks=$(find . -type f -not -links 1 | grep -v '/\(.git\|.hg\|.bzr\|_darcs\)/' ) || true - if [ -n "$hardlinks" ]; then - echo "etckeeper warning: hardlinked files could cause problems with $VCS:" >&2 - echo "$hardlinks" >&2 - fi -fi diff --git a/pre-commit.d/20warn-problem-files b/pre-commit.d/20warn-problem-files new file mode 100755 index 0000000..3e9e476 --- /dev/null +++ b/pre-commit.d/20warn-problem-files @@ -0,0 +1,27 @@ +#!/bin/sh +set -e + +exclude_internal () { + grep -v '/\(.git\|.hg\|.bzr\|_darcs\)/' +} + +if [ "$VCS" = hg ] || [ "$VCS" = bzr ] || [ "$VCS" = darcs ]; then + special=$(find . -not -type d -not -type f -not -type l | exclude_internal) || true + hardlinks=$(find . -type f -not -links 1 | exclude_internal ) || true +elif [ "$VCS" = git ]; then + special=$(find . -not -type d -not -type f -not -type l -exec git ls-files --exclude-standard --cached --others {} \; | exclude_internal) || true + hardlinks=$(find . -type f -not -links 1 -exec git ls-files --exclude-standard --cached --others {} \; | exclude_internal) || true +else + special="" +fi + +if [ -n "$special" ]; then + echo "etckeeper warning: special files could cause problems with $VCS:" >&2 + echo "$special" >&2 +fi +if [ -n "$hardlinks" ]; then + echo "etckeeper warning: hardlinked files could cause problems with $VCS:" >&2 + echo "$hardlinks" >&2 +fi + +true diff --git a/pre-commit.d/20warn-special-file b/pre-commit.d/20warn-special-file deleted file mode 100755 index f246fb1..0000000 --- a/pre-commit.d/20warn-special-file +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -set -e - -if [ "$VCS" = git ] || [ "$VCS" = hg ] || [ "$VCS" = bzr ] || [ "$VCS" = darcs ]; then - special=$(find . -not -type d -not -type f -not -type l | grep -v '/\(.git\|.hg\|.bzr\|_darcs\)/') || true - if [ -n "$special" ]; then - echo "etckeeper warning: special files could cause problems with $VCS:" >&2 - echo "$special" >&2 - fi -fi - -true |