git-annex/doc/todo/Make_addunlocked_configurable_like_largefiles.mdwn

45 lines
1.7 KiB
Markdown

Hi joey,
How about making `annex.addunlocked` configurable similar to `annex.largefiles` so different file types can be configured to be added unlocked and others locked?
The following illustrates a use case:
[[!format bash """
#!/bin/sh -x
# make a repo
export LC_ALL=C.UTF-8
chmod -R +w addunlocked;rm -rf addunlocked
git init addunlocked
cd addunlocked
git annex init
# configure *.txt files to be added unlocked so they stay editable
echo '*.txt annex.addunlocked=true' > .gitattributes
git add .gitattributes
git commit -m "Add .gitattributes"
# make a note
echo bla > notes.txt
git annex add
git annex sync -m "add notes.txt"
# However editing doesn't work as it was added locked
echo blubb >> notes.txt # fails as it was not added unlocked
"""]]
Probably not all matching options (like `copies` for example) make sense or work at all in this context, but at least `include=` would be useful („all files in that dir should be added unlocked always”). For example, in a synced folder for collaboration, PDFs could stay locked to save space, but Spreadsheets and ODT documents for example make sense to be added unlocked by default to stay editable. This could be achieved with something like this:
[[!format bash """
# repo-wide stored in git-annex branch
git annex config --set annex.addunlocked 'include=*.odt or include=**.pdf'
# folder-specific via .gitattributes
echo '*.pdf annex.addunlocked=true' >> .gitattributes # (or 'anything')
echo '*.odt annex.addunlocked=true' >> .gitattributes # (or 'anything')
# repo-specific
git config annex.addunlocked 'include=**/*.odt or include=**/*.pdf'
"""]]
What do you think?
Cheers, Yann
> [[notabug|done]] --[[Joey]]