aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2021-02-21 10:49:12 -0300
committerSilvio Rhatto <rhatto@riseup.net>2021-02-21 10:49:12 -0300
commit635f8de8df667872eab76536e02861171fa63fe4 (patch)
tree5904d6f32b187e7eec2da8386699cc870d0729fd
parent2435cb246a8d9f05bf69c4a4474eb1bc6aed12e7 (diff)
downloadscripts-635f8de8df667872eab76536e02861171fa63fe4.tar.gz
scripts-635f8de8df667872eab76536e02861171fa63fe4.tar.bz2
Feat: show: git management
-rwxr-xr-xshow13
1 files changed, 12 insertions, 1 deletions
diff --git a/show b/show
index 1485441..4be01ac 100755
--- a/show
+++ b/show
@@ -6,7 +6,8 @@
# 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"
@@ -16,7 +17,17 @@ MAX_AGE="86400"
# 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