From f8340fc9214921f03fb56e911d9cb620075cafb1 Mon Sep 17 00:00:00 2001 From: oadams Date: Tue, 7 Nov 2023 08:26:44 +0000 Subject: [PATCH 1/4] --- doc/forum/Using_git_annex_as_a_library.mdwn | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 doc/forum/Using_git_annex_as_a_library.mdwn diff --git a/doc/forum/Using_git_annex_as_a_library.mdwn b/doc/forum/Using_git_annex_as_a_library.mdwn new file mode 100644 index 0000000000..c76f98e9a6 --- /dev/null +++ b/doc/forum/Using_git_annex_as_a_library.mdwn @@ -0,0 +1,6 @@ +I've started writing a small tool in Haskell to manage data processing pipelines. I'm interested in using git-annex as a library as part of this (since the idea is that the raw data is tracked in git-annex and git). I'm wondering what the best way to go about doing it is. + +If I set my stack.yaml `extra-deps` to point to the git repository and run `stack build` then stack visibly goes and downloads the package. But from there I can't actually import any modules in my own Haskell program. When I use `import Git` or `import Annex.HashObject` then I get a compile error along the lines of `Could not find module ‘Annex.HashObject’`. + +Do you have any pointers for how I might best use git-annex as a library? Thanks for your help, sorry if it's so basic as I'm new to the Haskell tooling ecosystem. + From 9ef6257c2fcc6d99037ab882ea43240f18f95adb Mon Sep 17 00:00:00 2001 From: oadams Date: Tue, 7 Nov 2023 08:30:21 +0000 Subject: [PATCH 2/4] Added a comment --- .../comment_1_42cd26878e4e5c2c238c1227e3c372d9._comment | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 doc/forum/Using_git_annex_as_a_library/comment_1_42cd26878e4e5c2c238c1227e3c372d9._comment diff --git a/doc/forum/Using_git_annex_as_a_library/comment_1_42cd26878e4e5c2c238c1227e3c372d9._comment b/doc/forum/Using_git_annex_as_a_library/comment_1_42cd26878e4e5c2c238c1227e3c372d9._comment new file mode 100644 index 0000000000..d4ce3acd23 --- /dev/null +++ b/doc/forum/Using_git_annex_as_a_library/comment_1_42cd26878e4e5c2c238c1227e3c372d9._comment @@ -0,0 +1,8 @@ +[[!comment format=mdwn + username="oadams" + avatar="http://cdn.libravatar.org/avatar/ac166a5f89f10c4108e5150015e6751b" + subject="comment 1" + date="2023-11-07T08:30:21Z" + content=""" +I should add that I have just seen this discussion https://git-annex.branchable.com/forum/Using_git-annex_as_a_library/. Perhaps I should have posted there, but either way I'm wondering if things are different these days? +"""]] From 4d242b88eb731ef1f82719d87d63070ad59691f9 Mon Sep 17 00:00:00 2001 From: mih Date: Tue, 7 Nov 2023 15:49:47 +0000 Subject: [PATCH 3/4] Added a comment: What about temporary annex.private declaration? --- ..._f5490d034074ca80a712bdd41c307139._comment | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 doc/tips/cloning_a_repository_privately/comment_1_f5490d034074ca80a712bdd41c307139._comment diff --git a/doc/tips/cloning_a_repository_privately/comment_1_f5490d034074ca80a712bdd41c307139._comment b/doc/tips/cloning_a_repository_privately/comment_1_f5490d034074ca80a712bdd41c307139._comment new file mode 100644 index 0000000000..fb46c94c95 --- /dev/null +++ b/doc/tips/cloning_a_repository_privately/comment_1_f5490d034074ca80a712bdd41c307139._comment @@ -0,0 +1,39 @@ +[[!comment format=mdwn + username="mih" + avatar="http://cdn.libravatar.org/avatar/f881df265a423e4f24eff27c623148fd" + subject="What about temporary annex.private declaration?" + date="2023-11-07T15:49:47Z" + content=""" +The instructions indicate that `annex.private` should be set in the local repository configuration. + +However, the following approach is also a possibility: + +``` +❯ mkdir priv +❯ cd priv +❯ git init +Initialized empty Git repository in /tmp/priv/.git/ + +❯ git -c annex.private=1 annex init +init ok + +❯ ls .git/annex/journal-private +uuid.log + +❯ cat .git/config +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true +[annex] + uuid = 955373ac-6044-493e-a696-1a706437b542 + version = 10 +[filter \"annex\"] + smudge = git-annex smudge -- %f + clean = git-annex smudge --clean -- %f + process = git-annex filter-process +``` + +It seems this repository was in private mode when it was initialized (expected). What is the implication of the switch not being permanent in the config? And by extension: what are the implications of removing the switch later in the lifetime of a repository clone? +"""]] From 215c96be950e2ee9e4b83e341be82a346ec1b423 Mon Sep 17 00:00:00 2001 From: jcjgraf Date: Tue, 7 Nov 2023 20:42:11 +0000 Subject: [PATCH 4/4] --- ...___40____61____62___cannot_drop__41__.mdwn | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 doc/forum/Required_Content_Always_True___40____61____62___cannot_drop__41__.mdwn diff --git a/doc/forum/Required_Content_Always_True___40____61____62___cannot_drop__41__.mdwn b/doc/forum/Required_Content_Always_True___40____61____62___cannot_drop__41__.mdwn new file mode 100644 index 0000000000..0e4332efc5 --- /dev/null +++ b/doc/forum/Required_Content_Always_True___40____61____62___cannot_drop__41__.mdwn @@ -0,0 +1,82 @@ +Hey there, + +I am having the issue that git-annex reports files to be required even though it should not be. + +The setup is as follows (The groups that the repo is part of is specified in brackets): + +- Main repo (`origin`, `server`) on a server + - Regularly syncs all its data two two backup repos (`server`, `backup`, `backup_server`) + - These two backup repos are trusted, as they are not reachable by clients +- Client repo (`client`) on PC + - Syncs with other clients via the server + - Manually syncs with a backup repo (`backup` `offline`, `backup_offline`) on a disk + - Each client has two remotes, the server (named `origin`) and the backup drive (named `usb`) + +I want that the required content is everything present, that is not yet (all of them): + +1. in the server repo +2. in both server backup repos +3. in a backup repo on an external drive + +I specify that using `git annex required . "present and (copies=origin:0 or (not copies=backup_server:2) or copies=backup_offline:0)"`. + +Now I want to drop file `A` + +File `A` is present on 5 repos. However, I cannot delete it, as it is "apparently" not on the server (i.e. `copies=origin:0` is true). + +``` +$ git annex whereis A +whereis A (5 copies) + 0cdca96a-e44d-4168-a3a0-8ab846451e74 -- Server_Backup2 + 44039708-f0d9-4ed0-833b-4d146d419b5d -- jeanclaude [here] + 4ac4c649-b37c-403e-94e0-9497a7bc2a91 -- Server_Backup1 + c0d1b661-1e19-4956-b290-ff62abc6d61a -- jc_backup_wd6tb [usb] + da3e14a5-188f-4a65-bf93-8fce9e409d09 -- [origin] +ok + +$ git annex drop A --explain +drop A [ A matches required content: present[TRUE] and ( copies=origin:0[TRUE] ) ] + + That file is required content. It cannot be dropped! + + (Use --force to override this check, or adjust required content configuration.) +failed +drop: 1 failed +``` + +What is it saying that it is not no `origin`? Is there something wrong with my setup? Does the drop command try to *lock* file `A` on all remotes (except on the server backups, as they are trusted)? + + +Me doing some "debugging": + +``` +$ git annex required . "present and (copies=origin:1 or (not copies=backup_server:2) or copies=backup_offline:0)" +required . ok +(recording state in git...) + +$ git annex drop A --explain +drop A [ A matches required content: present[TRUE] and ( copies=origin:1[TRUE] ) ] + + That file is required content. It cannot be dropped! + + (Use --force to override this check, or adjust required content configuration.) +failed +drop: 1 failed + +$ git annex required . "present and (copies=origin:10 or (not copies=backup_server:2) or copies=backup_offline:0)" +required . ok +(recording state in git...) + +$ git annex drop 2022/220513-PolybandInConcert/220513_220256.cr3 --explain +drop A [ A matches required content: present[TRUE] and ( copies=origin:10[FALSE] or not copies=backup_server:2[TRUE] or copies=backup_offline:0[TRUE] ) ] + + That file is required content. It cannot be dropped! + + (Use --force to override this check, or adjust required content configuration.) +failed +drop: 1 failed +``` + +How can the number of copies on `origin` be `0` and `1` at the same time? Or do I misunderstand something completely? It also reports that the file in none of the backups (neither local nor remote). + +Thanks a lot your your time and effort!