From b6fcbbf5facc05c34194a1d9567859fdb16277e1 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 12 Sep 2025 17:51:39 -0300 Subject: Fix: hydractl: sync-media: manage metadata and sidecar files through Git directly, outside the annex --- docs/changelog.md | 3 +++ docs/todo.md | 3 --- share/hydractl/sync-media | 22 ++++++++++++++++++---- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 155459b..d2c2b59 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -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. diff --git a/docs/todo.md b/docs/todo.md index 3da4275..a361b95 100644 --- a/docs/todo.md +++ b/docs/todo.md @@ -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. diff --git a/share/hydractl/sync-media b/share/hydractl/sync-media index 0976c68..8593d06 100755 --- a/share/hydractl/sync-media +++ b/share/hydractl/sync-media @@ -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 {} \; } -- cgit v1.2.3