annex.skipunknown with transition plan

Added annex.skipunknown git config, that can be set to false to change the
behavior of commands like `git annex get foo*`, to not skip over files/dirs
that are not checked into git and are explicitly listed in the command
line.

Significant complexity was needed to handle git-annex add, which uses some
git ls-files calls, but needs to not use --error-unmatch because of course
the files are not known to git.

annex.skipunknown is planned to change to default to false in a
git-annex release in early 2022. There's a todo for that.
This commit is contained in:
Joey Hess 2020-05-28 15:55:17 -04:00
parent 5b28a37ea1
commit 89b2542d3c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
42 changed files with 271 additions and 169 deletions

View file

@ -35,3 +35,12 @@ P.S. It might be a related observation that git-annex metadata does exit with n
[[!tag projects/datalad]]
[[!meta title="silently skipping files that are not in git or not annexed is sometimes surprising to some"]]
> annex.skipunknown false will make git-annex error out in this situation.
> That will become the default in a couple of years, but can be set already
> by those who don't like the behavior of skipping.
>
> In the case of addurl --batch though, do see my first comment for a way to
> avoid any errors.
>
> [[done]] --[[Joey]]

View file

@ -27,7 +27,8 @@ temp file that is not in git, then they would have to change scripts
and workflows.
Implementing it may be as simple as passing --error-unmatch to git
ls-files.
ls-files. (And disable git-annex's code that checks for parameters that are
not existing files.)
It could be an option, but I don't really consider an option as fixing the
surprising behavior. And once you know git-annex behaves this way, I think

View file

@ -0,0 +1,17 @@
[[!comment format=mdwn
username="joey"
subject="""comment 3"""
date="2020-05-28T19:49:58Z"
content="""
Implemented annex.skipunknown git config, that will make it error out when
given a file that git doesn't know about.
Not default yet, will be in a couple of years.
[[todo/complete_annex.skipunknown_transition_in_2022]]
As to git-annex skipping non-annexed files, I'm leaning toward keeping it
the way it is, and it's not really the subject of this bug report, except
maybe that it's not entirely consistent with the annex.skipunknown
behavior for non-git files. If users complain about it, I'll consider it
again.
"""]]

View file

@ -51,3 +51,7 @@ It would be nice if git-annex could give an error to explain why the unlock fail
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
git-annex is amazing, I use it all the time. Thanks!
> annex.skipunknown false will make git-annex error out in this situation.
> That will become the default in a couple of years, but can be set already
> by those who don't like the behavior of skipping. [[done]] --[[Joey]]