From 7b489ed25d0e1e29707997d3a961f673286f7e96 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 26 Jun 2014 12:28:28 +0200 Subject: [PATCH] MT#7577 services: check for newly added config files `git diff-index --name-only HEAD` was used because it was the only reasonable way to check for modified files back in Git 1.5. Sadly this command can't detect files that didn't exist inside the Git repository at all yet (so if a file was generated for the very first time the according services script wasn't executed necessarily). Instead nowadays we can rely on `git status --porcelain`, which wasn't available in Git 1.5 back then yet. Even in Debian/squeeze there's Git version 1.7.2.5-3 available, so it's save to depend on it. Updated Git package dependency accordingly, also switch from transitional git-core package to the actual git one. --- debian/control | 2 +- scripts/services | 13 +------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/debian/control b/debian/control index 9025f52d..3e0a39c5 100644 --- a/debian/control +++ b/debian/control @@ -26,7 +26,7 @@ Package: ngcp-ngcpcfg Architecture: all Depends: etckeeper, file, - git-core, + git (>= 1:1.7.2.5-3~), libdata-validate-ip-perl, libdbd-mysql-perl, libdbi-perl, diff --git a/scripts/services b/scripts/services index b84ed3d2..f9356177 100755 --- a/scripts/services +++ b/scripts/services @@ -42,18 +42,7 @@ unifyer() { fi } -# NOTES: -# * 'git ls-files -o' also shows ignored files -# * 'git status --porcelain |grep '^?? ' not available in git 1.5 - -# The 'git diff' command fixes a strange race condition where 'git diff-index' -# lists *all* generated file(s) where the time stamp differs, resulting in a -# list of *all* generated files (which is not what we want). -# After running 'git diff' the following 'git diff-index ...' command lists -# only the modified files as we want and need it. See BTS #211 for bugreport. -git diff &>/dev/null - -for file in $(git diff-index --name-only HEAD) ; do +for file in $(git status --porcelain | sed 's/^...//') ; do if [ -r "$file" ] && [ -r "${SERVICES_POOL}/${file}".services ] ; then log_debug "unifyer ${SERVICES_POOL}/${file}.services" unifyer "${SERVICES_POOL}/${file}".services