add --force-annex/--force-git

options make it easier to override annex.largefiles configuration
(and potentially safer as it avoids bugs like the smudge bug fixed
in the last release)

Deleted some old comments that were posted to the man page discussing such
options.

Updated docs that used -c annex.largefiles to use the options.

Note that addSmallOverridden was needed to avoid the clean filter running
on the file. It would be possible to make addFile also update the index
directly, rather than going via git add. However, it was not necessary,
and I want to avoid breaking on some edge case, particularly if the code in
addSmallOverridden has some oversight.

Also, when annex.addunlocked is set and annex.largefiles does not match a file,
git annex add --force-large works, but git status will then show the file
as added, with a unstaged modification. The unstaged modification adds the
file to git. This is identical behavior to using -c annex.largefiles=nothing
when annex.addunlocked is set. This does not prevent committing what was
intended to be added. I have not gotten to the bottom of why git thinks
the file is modified and runs it through the clean filter in this case.
This commit is contained in:
Joey Hess 2020-01-01 14:03:06 -04:00
parent 022dead40a
commit 503788238c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
11 changed files with 74 additions and 84 deletions

View file

@ -1,5 +1,6 @@
Make `git-annex add --annex` and `git-annex add --git` add a specific file to
annex or git, bypassing annex.largefiles and all other configuration and state.
Make `git-annex add --force-large` and `git-annex add --force-small`
add a specific file to annex or git, bypassing annex.largefiles
and all other configuration and state.
One reason to want this is that it avoids users doing stuff like this:
@ -11,3 +12,5 @@ Such a temporary setting of annex.largefiles can be problimatic, as explored in
Also, this could also be used to easily switch a file from one storage to
the other. I suppose the file would have to be touched first to make git-annex
add process it?
> [[done]] --[[Joey]]