When annex.thin is set, allow hard links to be made between executable work tree files and annex objects.

This is safe, because while the annex object ends up executable,
there were already at least two other cases where it ended up executable:

1. git add an an executable file
2. chmod +x of a a non-executable worktree file that was hard linked to the
   annex object

After copy/hard link, it always fixes up the permissions to match the mode
of the worktree file, so when an executable annex object gets hard linked
to a non-executable worktree file, its execute bit gets removed.

Commit b7c8bf5274 already *said* it would do
this; I suspect the line of code I've removed was included in that commit
accidentially.

Also improves annex.thin documentation.

This commit was sponsored by Boyd Stephen Smith Jr. on Patreon.
This commit is contained in:
Joey Hess 2018-10-26 13:35:13 -04:00
parent e7e9c5744f
commit 3af29b3ba9
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 34 additions and 3 deletions

View file

@ -377,3 +377,5 @@ total 12
lil' positive end note mode on:
git-annex is the only thing to which I trust my archive of most valuable documents and memories!
> [[done]]; see comments --[[Joey]]

View file

@ -5,6 +5,7 @@
subject="comment 4"
date="2018-10-18T23:34:26Z"
content="""
I am stupid talking about executable files hardlinking. I think I just chmod-ed already hardlinking files, that's how I got it. No surprise.
I am ok with this quirk (executable files are not thinned), but just curious: what exactly influenced such design decision?

View file

@ -0,0 +1,24 @@
[[!comment format=mdwn
username="joey"
subject="""comment 5"""
date="2018-10-26T17:17:35Z"
content="""
[[!commit b7c8bf5274a64389ac87d6ce0388b8708c261971]] is where that was
implemented. Interestingly, its commit message does say that the annex
object file is made executable when using annex.thin.
And indeed, git add of an executable file with annex.thin set does
make the object executable and hard link to it.
But that commit contains this line that avoids hard linking:
| maybe False isExecutable destmode = copy =<< getstat
Which is what I based my earlier comment on. But without that line,
AFAIK it will behave the way you want, with the annex object and
executable worktree file being hard linked. The code also removes the
execute bit if the annex object file later ends up getting hard linked
instead to a non-executable file.
So, based on this analysis, I'm going to remove that line. And improve the
annex.thin docs slightly, and I think that's sufficient to close this bug.
"""]]