annex.addunlocked expressions
* annex.addunlocked can be set to an expression with the same format used by annex.largefiles, in case you want to default to unlocking some files but not others. * annex.addunlocked can be configured by git-annex config. Added a git-annex-matching-expression man page, broken out from tips/largefiles. A tricky consequence of this is that git-annex add --relaxed honors annex.addunlocked, but an expression might want to know the size or content of an url, which it's not going to download. I decided it was better not to fail, and just dummy up some plausible data in that case. Performance impact should be negligible. The global config is already loaded for annex.largefiles. The expression only has to be parsed once, and in the simple true/false case, it should not do any additional work matching it.
This commit is contained in:
parent
f79bd52132
commit
37467a008f
25 changed files with 305 additions and 179 deletions
|
@ -102,7 +102,8 @@ seek o@(LocalImportOptions {}) = startConcurrency commandStages $ do
|
|||
unless (null inrepops) $ do
|
||||
giveup $ "cannot import files from inside the working tree (use git annex add instead): " ++ unwords inrepops
|
||||
largematcher <- largeFilesMatcher
|
||||
(commandAction . startLocal largematcher (duplicateMode o))
|
||||
addunlockedmatcher <- addUnlockedMatcher
|
||||
(commandAction . startLocal addunlockedmatcher largematcher (duplicateMode o))
|
||||
`withPathContents` importFiles o
|
||||
seek o@(RemoteImportOptions {}) = startConcurrency commandStages $ do
|
||||
r <- getParsed (importFromRemote o)
|
||||
|
@ -114,8 +115,8 @@ seek o@(RemoteImportOptions {}) = startConcurrency commandStages $ do
|
|||
(importToSubDir o)
|
||||
seekRemote r (importToBranch o) subdir
|
||||
|
||||
startLocal :: GetFileMatcher -> DuplicateMode -> (FilePath, FilePath) -> CommandStart
|
||||
startLocal largematcher mode (srcfile, destfile) =
|
||||
startLocal :: AddUnlockedMatcher -> GetFileMatcher -> DuplicateMode -> (FilePath, FilePath) -> CommandStart
|
||||
startLocal addunlockedmatcher largematcher mode (srcfile, destfile) =
|
||||
ifM (liftIO $ isRegularFile <$> getSymbolicLinkStatus srcfile)
|
||||
( starting "import" (ActionItemWorkTreeFile (toRawFilePath destfile))
|
||||
pickaction
|
||||
|
@ -208,7 +209,11 @@ startLocal largematcher mode (srcfile, destfile) =
|
|||
warning $ "not overwriting existing " ++ destfile ++ " " ++ why
|
||||
stop
|
||||
lockdown a = do
|
||||
lockingfile <- not <$> addUnlocked
|
||||
let mi = MatchingFile $ FileInfo
|
||||
{ currFile = toRawFilePath srcfile
|
||||
, matchFile = toRawFilePath destfile
|
||||
}
|
||||
lockingfile <- not <$> addUnlocked addunlockedmatcher mi
|
||||
-- Minimal lock down with no hard linking so nothing
|
||||
-- has to be done to clean up from it.
|
||||
let cfg = LockDownConfig
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue