git-annex/doc/internals
Joey Hess 8b56d6b283
fix conflicting push situation
In a situation where there are two repos that are diverged and each pushes
in turn to git-remote-annex, the first to push updates it. Then the second
push fails because it is not a fast-forward. The problem is, before git
push fails with "non-fast-forward", it actually calls git-remote-annex
with push.

So, to the user it appears as if the push failed, but it actually reached
the remote, and overwrote the other push!

The only solution to this seems to be for git-remote-annex push to notice
when a non-force-push would overwrite a ref stored in the remote, and
refuse to push that ref, returning an error to git. This seems strange,
why would git make remote helpers implement that when it later checks the
same thing itself?

With this fix, it's still possible for a race to overwrite a change to
the MANIFEST and lose work that was pushed from the other repo. But that
needs two pushes to be running at the same time. From the user's
perspective, that situation is the same as if one repo pushed new work,
then the other repo did a git push --force, overwriting the first repo's
push. In the first repo, another push will then fail as a non
fast-forward, and the user can recover as usual. But, a MANIFEST
overwrite will leave bundle files in the remote that are not listed in
the MANIFEST. It seems likely that git-annex will eventually be able to
detect that after the fact and clean it up. Eg, it can learn all bundles
that are stored in the remote using the location log, and compare them
to the MANIFEST to find bundles that got lost.

The race can also appear to the user as if they pushed a ref, but then
it got deleted from the remote. This happens when two two pushes are
pushing different ref names. This might be harder for the user to
notice; git fetch does not indicate that a remote ref got deleted.
They would have to use git fetch --prune to notice the deletion.
Once the user does notice, they can re-push their ref to recover.

Sponsored-by: Jack Hill on Patreon
2024-04-26 15:03:04 -04:00
..
hashing
key_format
lockdown Added a comment 2022-05-20 18:09:45 +00:00
comment_1_4b8ed353dca4f484b3b6eb463fa02fd8._comment
comment_2_c19232d5cc4976c2e5b014aef6e8d9ec._comment
comment_3_5a26ee5aab274f321a4ea6f8527f53bd._comment
comment_4_81293b180fb09105ec158fdfef73d249._comment
comment_5_354012b6a9ac11160eb926234d38051f._comment
comment_7_7e40f744f9ac7f0403df9d1a2162a516._comment
comment_7_9c82a2878f3feb1b2a95662ed25b234b._comment
comment_8_9dccdd3a9556ceef54e318cd5c8a50ad._comment
comment_9_40442b012886ad698f448c262f0d7f4c._comment
comment_10_c4298babd96b2596bd4f6ad828212c92._comment
comment_11_9758bb3a17f63b4dcf51742ea482dbe9._comment
comment_12_f0325cefa5cd53a5a897046606137cef._comment
comment_13_e45b6fa035a30703618448a0f764f935._comment
comment_14_3f62751c2dd041f4ead1c6580ea5eec1._comment
comment_15_c3d12d14e4d044f39829c5d92f523655._comment
comment_16_2455c898d6c77a5437a2c1532144bb8a._comment
comment_17_df13b7e66963a6d2673e49f52afb978a._comment Added a comment: why othertmp to be on the same file system? 2022-12-13 14:15:28 +00:00
comment_18_1adce7945940b9c384c2383261388dd9._comment convert renameFile to moveFile to support cross-device moves 2022-12-20 15:17:50 -04:00
git-remote-annex.mdwn fix conflicting push situation 2024-04-26 15:03:04 -04:00
hashing.mdwn
key_format.mdwn
lockdown.mdwn
pointer_file.mdwn fully specify the pointer file format 2022-02-23 14:20:31 -04:00