improve function name

onAddUnlocked suggested that it had to add the file locked, but it
doesn't, it only queues the add of the file, and it's up to the
committer what to do -- which is currently indeed to always add the file
locked.
This commit is contained in:
Joey Hess 2021-09-27 12:52:30 -04:00
parent 5bc83b52d8
commit 0a951ac758
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -89,7 +89,7 @@ runWatcher :: Assistant ()
runWatcher = do
startup <- asIO1 startupScan
symlinkssupported <- liftAnnex $ coreSymlinks <$> Annex.getGitConfig
addhook <- hook $ onAddUnlocked symlinkssupported
addhook <- hook $ onAddFile symlinkssupported
delhook <- hook onDel
addsymlinkhook <- hook onAddSymlink
deldirhook <- hook onDelDir
@ -194,11 +194,11 @@ runHandler handler file filestatus = void $ do
shouldRestage :: DaemonStatus -> Bool
shouldRestage ds = scanComplete ds || forceRestage ds
onAddUnlocked :: Bool -> Handler
onAddUnlocked symlinkssupported f fs = do
onAddFile :: Bool -> Handler
onAddFile symlinkssupported f fs = do
mk <- liftIO $ isPointerFile $ toRawFilePath f
case mk of
Nothing -> onAddUnlocked' contentchanged addassociatedfile addlink samefilestatus symlinkssupported f fs
Nothing -> onAddFile' contentchanged addassociatedfile addlink samefilestatus symlinkssupported f fs
Just k -> addlink f k
where
addassociatedfile key file =
@ -222,14 +222,14 @@ onAddUnlocked symlinkssupported f fs = do
liftAnnex $ stagePointerFile (toRawFilePath file) mode =<< hashPointerFile key
madeChange file $ LinkChange (Just key)
onAddUnlocked'
onAddFile'
:: (Key -> FilePath -> Annex ())
-> (Key -> FilePath -> Annex ())
-> (FilePath -> Key -> Assistant (Maybe Change))
-> (Key -> FilePath -> FileStatus -> Annex Bool)
-> Bool
-> Handler
onAddUnlocked' contentchanged addassociatedfile addlink samefilestatus symlinkssupported file fs = do
onAddFile' contentchanged addassociatedfile addlink samefilestatus symlinkssupported file fs = do
v <- liftAnnex $ catKeyFile (toRawFilePath file)
case (v, fs) of
(Just key, Just filestatus) ->