CI to automate build of cargo lockfiles on different Alpine releases for git-annex aports https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/community/git-annex
Find a file
Joey Hess 6a9e923c74
fix handling of linked worktrees on filesystems w/o symlinks
Fix bug in handling of linked worktrees on filesystems not supporting
symlinks, that caused annexed file content to be stored in the wrong
location inside the git directory, and also caused pointer files to not get
populated.

This parameterizes functions in Annex.Locations with a GitLocationMaker.
The uses of standardGitLocationMaker are in cases where the path returned
by a function should not change when in a linked worktree. For example,
gitAnnexLink uses standardGitLocationMaker because symlink targets should
always be to ".git/annex/objects" paths, even when in a linked worktree.
Hopefully I have gotten all uses of standardGitLocationMaker right.

This also assumes that all path construction to the annex directory
is done via the functions in Annex.Locations, and there is no other,
ad-hoc construction elsewhere. Thankfully, Annex.Locations has been around
since the beginning, and has been used consistently. I think.

---

In fixupUnusualRepos, when symlinks are supported, the .git file is replaced
with a symlink to the linked worktree git directory. And in that directory,
an "annex" symlink points to the main annex directory. In that case,
it's not necessary to set mainWorkTreePath. It would be ok to set it,
but not setting it in that case allows an optimisation of avoiding reading
the "commondir" file.

The change to make fixupUnusualRepos set mainWorkTreePath when the
repository is not initialized yet is done in case the initialization itself
writes to the annex directory. If that were the case, without setting
mainWorkTreePath, the annex symlink would not be set up yet, and so
it might have created the annex directory in the wrong place. Currently
that didn't happen, but now that mainWorkTreePath is available, using it
here avoids any such later problem.

---

This commit does not deal with the mess of a worktree that has
experienced this bug before. In particular, if `git-annex get` were
run in such a worktree, it would have stored the object files in the
linked worktree's git directory, rather than in the main git directory.
Such misplaced object files need to be dealt with; the plan is to make
git-annex fsck notice and fix them.

A worktree that has experienced this bug before will contain unpopulated
pointer files. Those may eventually get fixed up in regular usage of
git-annex, but git-annex fsck will also fix them up.

---

Finally, this has me pondering if all of git-annex's state files should
really be stored in one common place across all linked worktrees. Should
perhaps state files that are specific to the worktree be stored per-worktree?
That has not been the case when using git-annex on filesystems supporting
symlinks, but it *has* been the case on filesystems not supporting
symlinks. Perhaps this leads to some other buggy behavior in some cases.
Or perhaps to extra work being done.

For example, the keys database has an associated files table. Which depends
on the worktree. But reconcileStaged updates that table, so when git-annex
is used first in one worktree and then in another one, reconcileStaged will
update the table to reflect the current worktree. Which is extra work each
time a different worktree is used. But also, what if two git-annex
processes are running at the same time, in separate worktrees? Probably
this needs more thought and investigation.

So there is a risk that this commit exposes such buggy behavior in a
situation where it didn't happen before, due to the filesystem not
supporting symlinks. But, given how much this bug crippled using linked
worktrees in such a situation, I doubt that many people have been doing
that.
2025-07-14 13:20:39 -04:00
Annex fix handling of linked worktrees on filesystems w/o symlinks 2025-07-14 13:20:39 -04:00
Assistant fix handling of linked worktrees on filesystems w/o symlinks 2025-07-14 13:20:39 -04:00
Backend refactor 2025-02-27 16:17:42 -04:00
Build OsPath conversion for OSXMkLibs 2025-02-14 16:53:00 -04:00
CmdLine fix handling of linked worktrees on filesystems w/o symlinks 2025-07-14 13:20:39 -04:00
Command support combineing --socket with HTTPs 2025-07-07 16:41:19 -04:00
Config bring back OsPath changes 2025-01-30 14:34:21 -04:00
Database fix handling of linked worktrees on filesystems w/o symlinks 2025-07-14 13:20:39 -04:00
debian Refresh standlone patch to avoid fuzz and offsets 2024-08-06 16:39:48 -04:00
doc subtlety 2025-07-11 15:55:50 -04:00
Git fix handling of linked worktrees on filesystems w/o symlinks 2025-07-14 13:20:39 -04:00
Limit treat "not present" in preferred content as invalid 2024-09-03 13:50:06 -04:00
Logs set fileEncoding in streamLogFileUnsafe 2025-05-08 14:59:42 -04:00
Messages more OsPath conversion (602/749) 2025-02-07 14:46:11 -04:00
P2P non-tor AuthTokens 2025-07-07 15:10:15 -04:00
Remote fix handling of linked worktrees on filesystems w/o symlinks 2025-07-14 13:20:39 -04:00
RemoteDaemon non-tor AuthTokens 2025-07-07 15:10:15 -04:00
standalone Fix installation on Android 2025-01-07 14:13:46 -04:00
static Revert "remove newlines from static js and css" 2014-06-13 02:20:39 -04:00
templates webapp: Rename "Upgrade Repository" to "Convert Repository" 2025-06-24 12:33:48 -04:00
Test prevent initialization with bad freeze/thaw hook configured 2025-05-27 12:54:31 -04:00
Types annex.fastcopy 2025-06-03 15:01:38 -04:00
Upgrade remove unused adjustedBranchRefresh associated file parameter 2025-02-21 14:51:02 -04:00
Utility prevent relatedTemplate from truncating a filename to end in whitespace 2025-06-23 13:31:15 -04:00
.appveyor.yml reenable appveyor test suite 2025-07-02 13:46:21 -04:00
.codespellrc A few more of typo fixes/skip as detected with bleeding edge codespell 2024-05-01 20:06:08 -04:00
.ghci turn of PackageImports in cabal file 2022-02-25 13:16:36 -04:00
.gitattributes update changelog location 2016-08-22 23:54:11 -04:00
.gitignore add git-remote-tor-annex target 2025-05-30 13:28:36 -04:00
.mailmap ENH: add one more mailmap for yarikoptic 2024-06-03 13:00:45 -04:00
Annex.hs add cache for getNumMinCopiesAttr 2025-05-12 14:37:23 -04:00
Assistant.hs OsPath transition Windows build fixes 2025-02-11 15:40:53 -04:00
Author.hs improve attribution armoring 2023-11-21 11:34:21 -04:00
Backend.hs refactoring 2025-02-27 14:54:03 -04:00
bash-completion.bash bash completion fix 2018-11-12 13:23:05 -04:00
Benchmark.hs --size-limit exit 101 2021-06-04 16:43:47 -04:00
BuildFlags.hs update servant build flag 2024-07-23 08:53:56 -04:00
BuildInfo.hs update licenses from GPL to AGPL 2019-03-13 15:48:14 -04:00
CHANGELOG fix handling of linked worktrees on filesystems w/o symlinks 2025-07-14 13:20:39 -04:00
CmdLine.hs more OsPath conversion (639/749) 2025-02-07 16:07:05 -04:00
Command.hs more OsPath conversion (542/749) 2025-02-06 11:38:14 -04:00
Common.hs bring back OsPath changes 2025-01-30 14:34:21 -04:00
Config.hs more OsPath conversion 2025-01-29 11:53:20 -04:00
COPYRIGHT added git-annex-compute-singularity 2025-03-10 16:41:26 -04:00
Creds.hs more OsPath conversion 2025-02-04 16:09:47 -04:00
Crypto.hs bring back OsPath changes 2025-01-30 14:34:21 -04:00
git-annex.cabal releasing package git-annex version 10.20250630 2025-06-30 10:05:44 -04:00
git-annex.hs git-remote-annex: Fix buggy behavior when annex.stalldetection is configured 2024-11-25 12:14:52 -04:00
Git.hs remove unncessary comment 2025-04-22 14:03:51 -04:00
Key.hs more OsPath conversion 2025-01-28 15:46:00 -04:00
Limit.hs implement balanced=groupname:lackingcopies 2025-05-12 14:27:32 -04:00
Logs.hs more OsPath conversion 2025-01-28 16:31:19 -04:00
Makefile be quite about ln on make all 2025-05-30 13:29:58 -04:00
Messages.hs more OsPath conversion 2025-01-28 15:46:00 -04:00
NEWS prep release 2023-06-26 10:41:36 -04:00
README improve description 2022-01-06 12:24:27 -04:00
Remote.hs compute remote: get input files from other remotes 2025-03-04 11:06:58 -04:00
Setup.hs Setup.hs: Stop installing man pages, desktop files, and the git-annex-shell and git-remote-tor-annex symlinks 2023-08-01 15:08:56 -04:00
stack.yaml update to nightly-2025-04-04 2025-04-04 20:16:43 -04:00
Test.hs OsPath build fix 2025-02-17 14:56:56 -04:00
Types.hs plumb VerifyConfig into retrieveKeyFile 2021-08-17 12:43:13 -04:00
Upgrade.hs more OsPath conversion (464/749) 2025-02-04 13:35:17 -04:00

git-annex allows managing large files with git, without storing the file
contents in git. It can sync, backup, and archive your data, offline
and online. Checksums and encryption keep your data safe and secure. Bring
the power and distributed nature of git to bear on your large files with
git-annex.

For documentation, see doc/ or <https://git-annex.branchable.com/>