repo-remove: remove deltas file if it becomes empty

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Florian Pritz 2012-04-06 18:17:06 +02:00 committed by Dan McGee
parent 3be02aa27c
commit 62e8812fb9
1 changed files with 5 additions and 0 deletions

View File

@ -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