From 62e8812fb9002bf2d737375003652bc6becc9f54 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 6 Apr 2012 18:17:06 +0200 Subject: [PATCH] repo-remove: remove deltas file if it becomes empty Signed-off-by: Florian Pritz Signed-off-by: Dan McGee --- scripts/repo-add.sh.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 043a0b86..5159ea2f 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -176,6 +176,11 @@ db_remove_delta() { if grep -q "$filename" $deltas; then sed -i.backup "/$filename/d" $deltas && rm -f $deltas.backup msg2 "$(gettext "Removing existing entry '%s'...")" "$filename" + # empty deltas file contains only "%DELTAS%" + if (( $(wc -l < "$deltas") == 1 )); then + msg2 "$(gettext "Removing empty deltas file ...")" + rm "$deltas" + fi return 0 fi