clean up git-remote-annex git-annex branch handling

Implemented alternateJournal, which git-remote-annex
uses to avoid any writes to the git-annex branch while setting up
a special remote from an annex:: url.

That prevents the remote.log from being overwritten with the special
remote configuration from the url, which might not be 100% the same as
the existing special remote configuration.

And it prevents an overwrite deleting of other stuff that was
already in the remote.log.

Also, when the branch was created by git-remote-annex, only delete it
at the end if nothing else has been written to it by another command.
This fixes the race condition described in
797f27ab05, where git-remote-annex
set up the branch and git-annex init and other commands were
run at the same time and their writes to the branch were lost.
This commit is contained in:
Joey Hess 2024-05-15 17:33:38 -04:00
parent d24d8870c5
commit adcebbae47
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 84 additions and 66 deletions

View file

@ -10,26 +10,6 @@ will be available to users who don't use datalad.
This is implememented and working. Remaining todo list for it:
* Cloning writes the new special remote config into remote.log,
and *deletes* other special remote configs.
The remote config from the url may be slightly different as well
than the existing one. Cloning should not write it.
* The race condition described in
[[!commit 797f27ab0517e0021363791ff269300f2ba095a5]]
where before git-annex init is run in a repo,
using git-remote-annex and at the same time git-annex init can lose
changes that the latter command (and ones after it) write to the
git-annex branch.
This should be fixable by making git-remote-annex not write to the
git-annex branch, but to eg, a temporary journal directory.
Also, when the remote uses importtree=yes, pushing to it updates
content identifiers, which currently get recorded in the git-annex
branch. It would be good to avoid that being written as well.
* Test incremental push edge cases involving checkprereq.
* Cloning from an annex:: url with importtree=yes doesn't work