Merge branch 'master' of ssh://git-annex.branchable.com

This commit is contained in:
Joey Hess 2023-11-08 14:14:41 -04:00
commit ae401fae14
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 135 additions and 0 deletions

View file

@ -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!

View file

@ -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.

View file

@ -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?
"""]]

View file

@ -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?
"""]]