annex.gitaddtoannex configuration

Added annex.gitaddtoannex configuration. Setting it to false prevents
git add from usually adding files to the annex.
(Unless the file was annexed before, or a renamed annexed file is detected.)

Currently left at true; some users are encouraging it be set to false.
This commit is contained in:
Joey Hess 2019-10-23 15:20:00 -04:00
parent ec08b66bda
commit bd197be3ad
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
8 changed files with 75 additions and 8 deletions

View file

@ -0,0 +1,15 @@
[[!comment format=mdwn
username="joey"
subject="""comment 31"""
date="2019-10-23T19:20:25Z"
content="""
This will get the behavior you seek, once you have upgraded to current
master:
git config annex.gitaddtoannex false
It could be made to default to false, TBD. If someone wants to make a patch
to all the documentation that currently talks about using git add and git
commit -a to annex files, to document the mooted new behavior, that would
be helpful.
"""]]

View file

@ -897,6 +897,20 @@ Like other git commands, git-annex is configured via `.git/config`.
See <https://git-annex.branchable.com/tips/largefiles> for details.
* `annex.gitaddtoannex`
This controls the behavior of `git add`. If you want `git add` to
add files to the annex (either all files, or the files matched
by your annex.largefiles configuration), set it to true.
To make `git add` add files to git but not to the annex, set it to false.
Note that `git add` will still add files to the annex in a couple of
situations. When an annexed file has been modified, it makes sense to add
the new version to the annex too. When an annexed file has been renamed
to a new name, it should remain annexed.
The default is currently true.
* `annex.addsmallfiles`
Controls whether small files (not matching annex.largefiles)

View file

@ -42,3 +42,7 @@ databases.
Some filesystems don't have stable inodes etc, but all that is already
handled by the InodeCache machinery, so I think this could work pretty
well. --[[Joey]]
> [[done]] although the sql database is used in a horrible way by the
> current implementation, which is probably very slow in some situations,
> so [[sqlite_database_improvements]] are now really needed. --[[Joey]]

View file

@ -3,3 +3,5 @@ Could there be separate `annex.git-add.largefiles` and `annex.git-annex-add.larg
Reason: to prevent `git add` from inadvertently adding annexed files in unlocked form, I set `* annex.largefiles=nothing` at repo root; but then, `git annex add` won't annex anything either, unless specifically asked. I want to use `git add` to add files to git only (since it can't add them to git-annex in locked form), and to use `git annex add` to add files to either git or annex based on `annex.git-annex-add.largefiles` setting.
Related: [[forum/lets_discuss_git_add_behavior]]
> [[wontfix|done]] --[[Joey]]

View file

@ -0,0 +1,12 @@
[[!comment format=mdwn
username="joey"
subject="""comment 3"""
date="2019-10-23T19:25:21Z"
content="""
I suspect that anyone who would have wanted this will instead be happy
with setting the new annex.gitaddtoannex to false.
If someone does have a good reason to want git add and git annex add to
have different opinions about what constitutes a large file, please reopen
the todo with a justification.
"""]]