aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2025-09-12 17:51:39 -0300
committerSilvio Rhatto <rhatto@riseup.net>2025-09-12 17:51:39 -0300
commitb6fcbbf5facc05c34194a1d9567859fdb16277e1 (patch)
tree324b07c025252978e94db4f4e0e78f5d74fca568
parent106942de613acf080fa2e5169ec79fca7e3bd9a1 (diff)
downloadhydra-master.tar.gz
hydra-master.tar.bz2
Fix: hydractl: sync-media: manage metadata and sidecar files through Git directly, outside the annexHEADmaster
-rw-r--r--docs/changelog.md3
-rw-r--r--docs/todo.md3
-rwxr-xr-xshare/hydractl/sync-media22
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 {} \;
}