I need to implement some functionality that should work in similar ways when faced with a plain Git vs a git-annex repo. In this context I am looking for the cheapest of the appropriate tests for an initialized annex?
I have looked at
git config annex.uuid
(~3ms)git rev-parse git-annex
(~3ms)git annex info --fast -q
(~50ms)
Are the fast ones sufficient to guarantee that no subsequent call to a git-annex command would yield git-annex: First run: git-annex init
?
Thanks!
git config annex.uuid
seems reliable enough to me - the uuid is stored in.git/config
and doesn't exist if it's not annex-inited (assuming no malicious behavior).If you're looking for the very cheapest, perhaps something like a file-exists check on
.git/annex
would work? I don't know if there are any edge cases with this one, though.annex.uuid is the right way.
I would not trust checking existence of .git/annex directory. There may be some situation where the repo is initialized, then uninitialized, but that directory still exists. Or similar.