tuxlover/etckeeper-ng — Issue #3: Already excluded files can get exluded again
Author: tuxlover
Created: 2012-02-01 18:06:25+00:00
State: open

Whenever files where exluded by -e option you should not be able adding the same file again to the exlude list.

Wokaround: Remove duplicate entries by hand and use git afterwards.

Fix: using a filter to look up already added files and permitting this should be easy:
Snippet:
was_added=$(grep $file &> /dev/null && echo "yes" || echo "yes")

if [ "$was_added" == "yes" ]
then
echo "this file was already added. not adding it again."
continue
fi

however it is crucial to prevent getting files in the list which also expand to same files. how can we archive this? so this might be a better solution:
expand files in the array and lookup if an array has entries listed twice.