, importToSubDir :: Maybe FilePath
, importContent :: Bool
, checkGitIgnoreOption :: CheckGitIgnore
+ , messageOption :: Maybe String
}
optParser :: CmdParamsDesc -> Parser ImportOptions
)
dupmode <- fromMaybe Default <$> optional duplicateModeParser
ic <- Command.Add.checkGitIgnoreSwitch
- return $ case mfromremote of
+ message <- optional (strOption
+ ( long "message" <> short 'm' <> metavar "MSG"
+ <> help "commit message"
+ ))
+ pure $ case mfromremote of
Nothing -> LocalImportOptions ps dupmode ic
Just r -> case ps of
[bs] ->
(if null subdir then Nothing else Just subdir)
content
ic
+ message
_ -> giveup "expected BRANCH[:SUBDIR]"
data DuplicateMode = Default | Duplicate | DeDuplicate | CleanDuplicates | SkipDuplicates | ReinjectDuplicates
(pure Nothing)
(Just <$$> inRepo . toTopFilePath . toRawFilePath)
(importToSubDir o)
- seekRemote r (importToBranch o) subdir (importContent o) (checkGitIgnoreOption o)
+ seekRemote r (importToBranch o) subdir (importContent o)
+ (checkGitIgnoreOption o)
+ (messageOption o)
startLocal :: ImportOptions -> AddUnlockedMatcher -> GetFileMatcher -> DuplicateMode -> (RawFilePath, RawFilePath) -> CommandStart
startLocal o addunlockedmatcher largematcher mode (srcfile, destfile) =
verifyEnoughCopiesToDrop [] key Nothing needcopies mincopies [] preverified tocheck
(const yes) no
-seekRemote :: Remote -> Branch -> Maybe TopFilePath -> Bool -> CheckGitIgnore -> CommandSeek
-seekRemote remote branch msubdir importcontent ci = do
+seekRemote :: Remote -> Branch -> Maybe TopFilePath -> Bool -> CheckGitIgnore -> Maybe String -> CommandSeek
+seekRemote remote branch msubdir importcontent ci mimportmessage = do
importtreeconfig <- case msubdir of
Nothing -> return ImportTree
Just subdir ->
includeCommandAction $
commitimport imported
where
- importmessage = "import from " ++ Remote.name remote
+ importmessage = fromMaybe
+ ("import from " ++ Remote.name remote)
+ mimportmessage
tb = mkRemoteTrackingBranch remote branch
let (branch, subdir) = splitRemoteAnnexTrackingBranchSubdir b
if canImportKeys remote importcontent
then do
- Command.Import.seekRemote remote branch subdir importcontent (CheckGitIgnore True)
+ Command.Import.seekRemote remote branch subdir importcontent (CheckGitIgnore True) Nothing
-- Importing generates a branch
-- that is not initially connected
-- to the current branch, so allow
--- /dev/null
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2024-01-18T16:18:38Z"
+ content="""
+This would need to start with `git-annex import --from=remote`
+getting a `--message` option. Which I've just implemented.
+
+As for adding an option to `git-annex pull`, it would need to be an option
+other than `--message`, because `git-annex sync` already uses `--message`
+for the commit message. And since `git-annex pull` can pull from more than
+one remote at a time, it seems that it would need an option that specifies
+a message plus which remote to use that message for. Or the option
+would need to only be used when using `git-annex pull` with a single
+specified remote.
+
+That seems like perhaps unncessary complexity, since if you want to import
+a tree from a remote and specify a message, you can just use
+`git-annex import` with `--message` now.
+And then you can run `git-annex pull` to proceed with the rest of what it does.
+
+Good enough?
+"""]]
`git-annex get` can later be used to download files, as desired.
The --no-content option is not supported by all special remotes.
+* `--message=msg` `-m msg`
+
+ Use this option to specify a commit message for the changes that have
+ been made to the special remote since the last import from it.
+
# IMPORTING FROM A DIRECTORY
When run with a path, `git annex import` **moves** files from somewhere outside