Please describe the problem.
If .gitattributes
contains * annex.largefiles=anything
, then git add
will add files in an unlocked state. According to this page (https://git-annex.branchable.com/tips/unlocked_files/) though, git-annex should add files in a locked state by default:
By default, git-annex commands will add files in locked mode, unless used on a filesystem that does not support symlinks, when unlocked mode is used. To make them always use unlocked mode, run: git config annex.addunlocked true
What steps will reproduce the problem?
cd $(mktemp -d)
git init
echo '* annex.largefiles=anything' > .gitattributes
git add .
git commit -m "Add gitattributes"
git annex init
cat >> annexed.txt <<EOF
This text file is unlocked
EOF
git add .
git commit -m "Add annexed"
Observe that annexed.txt will be added as a pointer file, i.e. in unlocked mode.
What version of git-annex are you using? On what operating system?
Latest from conda-forge on Ubuntu 22.04: git-annex 10.20230626 alldep_h97b9560_100 conda-forge
Please provide any additional information below.
# If you can, paste a complete transcript of the problem occurring here.
# If the problem is with the git-annex assistant, paste in .git/annex/daemon.log
(git-annex) $ bash <script-with-commands-from-reproduce-section>
Initialized empty Git repository in /tmp/tmp.XzlfX1juzC/.git/
[main (root-commit) 7633536] Add gitattributes
1 file changed, 1 insertion(+)
create mode 100644 .gitattributes
init ok
(recording state in git...)
(recording state in git...)
[main 60f1b44] Add annexed
1 file changed, 1 insertion(+)
create mode 100644 annexed.txt
(git-annex) $ cd /tmp/tmp.XzlfX1juzC
(git-annex) /tmp/tmp.XzlfX1juzC$ ls -l
total 4
-rw-rw-r-- 1 <user> <group> 27 Okt 23 17:12 annexed.txt
(git-annex) /tmp/tmp.XzlfX1juzC$ git annex find --unlocked
annexed.txt
(git-annex) /tmp/tmp.XzlfX1juzC$
# End of transcript or log.
I wish it were possible to make
git add
add files in a locked state. However, the smudge/clean interface git-annex uses to hook intogit add
makes it impossible to do that.This is why the documentation refers to "git-annex commands", which does exclude
git add
. I've made that a little bit more explicit.