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:
parent
80e9a655f8
commit
e955912ad0
16 changed files with 224 additions and 47 deletions
43
Command/Assist.hs
Normal file
43
Command/Assist.hs
Normal file
|
@ -0,0 +1,43 @@
|
|||
{- git-annex command
|
||||
-
|
||||
- Copyright 2023 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module Command.Assist (cmd) where
|
||||
|
||||
import Command
|
||||
import qualified Command.Sync
|
||||
import qualified Command.Add
|
||||
import Annex.CheckIgnore
|
||||
|
||||
cmd :: Command
|
||||
cmd = withAnnexOptions [jobsOption, backendOption] $
|
||||
command "assist" SectionCommon
|
||||
"add files and sync changes with remotes"
|
||||
(paramRepeating paramRemote)
|
||||
(myseek <--< Command.Sync.optParser Command.Sync.AssistMode)
|
||||
|
||||
myseek :: Command.Sync.SyncOptions -> CommandSeek
|
||||
myseek o = startConcurrency transferStages $ do
|
||||
-- Run before prepMerge so it adds only files in the current
|
||||
-- directory and below, not new files elsewhere in the working
|
||||
-- tree.
|
||||
Command.Add.seek Command.Add.AddOptions
|
||||
{ Command.Add.addThese = []
|
||||
, Command.Add.batchOption = NoBatch
|
||||
, Command.Add.updateOnly = False
|
||||
, Command.Add.largeFilesOverride = Nothing
|
||||
, Command.Add.checkGitIgnoreOption = CheckGitIgnore (False)
|
||||
, Command.Add.dryRunOption = DryRun False
|
||||
}
|
||||
|
||||
Command.Sync.prepMerge
|
||||
Command.Sync.seek' o'
|
||||
where
|
||||
o'
|
||||
| Command.Sync.contentOption o == Nothing
|
||||
&& Command.Sync.noContentOption o == Nothing =
|
||||
o { Command.Sync.contentOption = Just True }
|
||||
| otherwise = o
|
Loading…
Add table
Add a link
Reference in a new issue