git-annex assist

assist: New command, which is the same as git-annex sync but with
new files added and content transferred by default.

(Also this fixes another reversion in git-annex sync,
--commit --no-commit, and --message were not enabled, oops.)

See added comment for why git-annex assist does commit staged
changes elsewhere in the work tree, but only adds files under
the cwd.

Note that it does not support --no-commit, --no-push, --no-pull
like sync does. My thinking is, why should it? If you want that
level of control, use git commit, git annex push, git annex pull.
Sync only got those options because pull and push were not split
out.

Sponsored-by: k0ld on Patreon
This commit is contained in:
Joey Hess 2023-05-18 14:37:29 -04:00
parent 80e9a655f8
commit e955912ad0
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
16 changed files with 224 additions and 47 deletions

View file

@ -34,3 +34,5 @@ while true;do git annex sync --content;done
What do you think?
Cheers, Yann
> [[done]] as `git-annex assist` --[[Joey]]

View file

@ -0,0 +1,31 @@
[[!comment format=mdwn
username="joey"
subject="""comment 10"""
date="2023-05-18T17:45:44Z"
content="""
Implementing `git-annex assist` now...
A tricky point is, should it add files only in the current directory and
below, or all files in the repository? Note that the assistant can be run
in a directory and it will only add changed/new files in that directory,
although it can receive pulls that change files in other directories
(and will then download those files content).
OTOH, `git-annex sync` commits all changes, not only those in the
current directory. (The assistant does in some circumstanges commit
changes made outside the current directory. Its behavior is a bit
inconsistent in this area.)
So I think it makes sense for `git-annex assist` to only add files in the
current directory by default. (Of course an option like -A could be added
later.)
And while I'm a bit ambivilant about it, I'm making it commit all staged
changes, not only those in the current directory. As well as following the
behavior of `git-annex sync` and to an extent the assistant, it seems to
me that if you run `git-annex add ../foo; git-annex assist`, you are
intentionally building up a commit that includes file "foo". The same
as if you ran `git-annex add ../foo; git-annex add .` ... If you're not,
and you care about what files get added in what commit, you can of course
commit manually.
"""]]