]> gitweb.fluxo.info Git - hydra.git/commitdiff
Fix: hydractl: sync-media: manage metadata and sidecar files through Git directly...
authorSilvio Rhatto <rhatto@riseup.net>
Fri, 12 Sep 2025 20:51:39 +0000 (17:51 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Fri, 12 Sep 2025 20:51:39 +0000 (17:51 -0300)
docs/changelog.md
docs/todo.md
share/hydractl/sync-media

index 155459b3e9281e03d7884251b2eb5af199e72875..d2c2b596a784ec911d33343521c39a06dff75fc7 100644 (file)
@@ -19,3 +19,6 @@
 * [x] Provision: increase default partition sizes from 20G to 40G, as nowadays
       distro size increase a lot and a 20G system partition can be filled in
       easily.
+* [x] Sync media: `sync-media` does a `git unannex` on sidecar and other metadata
+      files and manage them through Git, instead of keeping them as unlocked
+      files.
index 3da42752ccfb9b07691c2854c72ed5c45803a597..a361b95151d5a2cc87a40b8474513284b2174a11 100644 (file)
@@ -35,9 +35,6 @@
           from [utils-doc][https://git.fluxo.info/utils-doc].
     * [ ] Run `git submodule --update --init --recursive` after running
           `git annex sync`.
-    * [ ] Shall `sync-media` do a `git unannex` on sidecar and other metadata
-          files and manage them through Git instead, or keep them as unlocked
-          files?
     * [ ] Syncing packages: a frontend to `apt-offline` that uses `git-annex`
           repositories: getting, installing, cleaning. One node can request
           packages through an external drive, and another can fetch then.
index 0976c6896488ba9176e7c388e477dc2f914ae6ad..8593d06636d7e3c75ce4e44b65b6a0455c9ed2cf 100755 (executable)
@@ -54,20 +54,34 @@ function sync_media_add {
 
 # Add meta files, making sure they're handled directly by Git
 function sync_media_add_metadata {
+  # Metadata state on the annex
+  #
+  # * add: metadata is managed in the annex, normally.
+  # * unlock: managed in the annex, but modifications are tracked as well.
+  # * unannex: metadata is kept out of the annex, but still tracked by Git.
+  #
+  # Usually, they should be regular files trackes by Git, so `git diff`
+  # works as expected.
+  #
+  #metadata_state="add"
+  #metadata_state="unlock"
+  metadata_state="unannex"
+
   # Playlist files in the playlist folder
   if [ -d "playlists" ]; then
-    find playlists -name '*.m3u' -type l -exec git annex unlock {} \;
+    find playlists -name '*.m3u' -type l -exec git annex $metadata_state {} \;
     find playlists -name '*.m3u'         -exec git add {} \;
   fi
 
   # Koreader metadata files
-  find -name metadata.pdf.lua     -type l -exec git annex unlock {} \;
+  find -name metadata.pdf.lua     -type l -exec git annex $metadata_state {} \;
+  find -name metadata.pdf.lua     -type l -exec git annex $metadata_state {} \;
   find -name metadata.pdf.lua             -exec git add {} \;
-  find -name metadata.pdf.lua.old -type l -exec git annex unlock {} \;
+  find -name metadata.pdf.lua.old -type l -exec git annex $metadata_state {} \;
   find -name metadata.pdf.lua.old         -exec git add {} \;
 
   # Darktable sidecar files
-  find -name '*.xmp' -type l -not -path '*.git*' -exec git annex unlock {} \;
+  find -name '*.xmp' -type l -not -path '*.git*' -exec git annex $metadata_state {} \;
   find -name '*.xmp'         -not -path '*.git*' -exec git add {} \;
 }