# Parameters
BASENAME="`basename $0`"
DOCS="$HOME/data/doc"
-LIST="$DOCS/.filelist"
+FILELIST=".filelist"
+LIST="$DOCS/$FILELIST"
DOC_PATTERN=".*\.(txt|doc|docx|rtf|pdf|sxc|csv|odt|odf|ods|xls|xlsx|ppt|epub|mobi|djvu|lit)"
FIND_OPTS="-not -path '*.git*' -regextype posix-egrep -iregex"
ITEM="$1"
# Update the filelist
function __update_filelist {
echo "Generating new filelist..."
+
+ # Unnanex if it was erroneously annexed
+ if [ -h "$LIST" ] && [ -d "$DOCS/.git/annex" ]; then
+ ( cd $DOCS && git annex unlock $FILELIST )
+ fi
+
+ # Refresh
cd $DOCS && find . $FIND_OPTS "$DOC_PATTERN" > $LIST
+
+ # Stage
+ git add $LIST
}
# Check