]> gitweb.fluxo.info Git - scripts.git/commitdiff
Feat: show: git management
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 21 Feb 2021 13:49:12 +0000 (10:49 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 21 Feb 2021 13:49:12 +0000 (10:49 -0300)
show

diff --git a/show b/show
index 1485441ffe4d1e7551024f4d40c934d6805142e8..4be01acdf47f17e19842f50f31da75d5695a1b14 100755 (executable)
--- 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