assistant: Add dotfiles to git by default, unless annex.dotfiles is configured
Tthe same as git-annex add does. Sponsored-by: Luke Shumaker on Patreon
This commit is contained in:
parent
357291c13c
commit
38153ad340
3 changed files with 19 additions and 8 deletions
|
@ -38,6 +38,7 @@ import qualified Annex
|
|||
import Utility.InodeCache
|
||||
import qualified Database.Keys
|
||||
import qualified Command.Sync
|
||||
import Config.GitConfig
|
||||
import Utility.Tuple
|
||||
import Utility.Metered
|
||||
import qualified Utility.RawFilePath as R
|
||||
|
@ -56,6 +57,7 @@ commitThread = namedThread "Committer" $ do
|
|||
delayadd <- liftAnnex $
|
||||
fmap Seconds . annexDelayAdd <$> Annex.getGitConfig
|
||||
largefilematcher <- liftAnnex largeFilesMatcher
|
||||
annexdotfiles <- liftAnnex $ getGitConfigVal annexDotFiles
|
||||
msg <- liftAnnex Command.Sync.commitMsg
|
||||
lockdowndir <- liftAnnex $ fromRepo gitAnnexTmpWatcherDir
|
||||
liftAnnex $ do
|
||||
|
@ -65,7 +67,7 @@ commitThread = namedThread "Committer" $ do
|
|||
(fromRawFilePath lockdowndir)
|
||||
void $ createAnnexDirectory lockdowndir
|
||||
waitChangeTime $ \(changes, time) -> do
|
||||
readychanges <- handleAdds (fromRawFilePath lockdowndir) havelsof largefilematcher delayadd $
|
||||
readychanges <- handleAdds (fromRawFilePath lockdowndir) havelsof largefilematcher annexdotfiles delayadd $
|
||||
simplifyChanges changes
|
||||
if shouldCommit False time (length readychanges) readychanges
|
||||
then do
|
||||
|
@ -261,8 +263,8 @@ commitStaged msg = do
|
|||
- Any pending adds that are not ready yet are put back into the ChangeChan,
|
||||
- where they will be retried later.
|
||||
-}
|
||||
handleAdds :: FilePath -> Bool -> GetFileMatcher -> Maybe Seconds -> [Change] -> Assistant [Change]
|
||||
handleAdds lockdowndir havelsof largefilematcher delayadd cs = returnWhen (null incomplete) $ do
|
||||
handleAdds :: FilePath -> Bool -> GetFileMatcher -> Bool -> Maybe Seconds -> [Change] -> Assistant [Change]
|
||||
handleAdds lockdowndir havelsof largefilematcher annexdotfiles delayadd cs = returnWhen (null incomplete) $ do
|
||||
let (pending, inprocess) = partition isPendingAddChange incomplete
|
||||
let lockdownconfig = LockDownConfig
|
||||
{ lockingFile = False
|
||||
|
@ -289,11 +291,16 @@ handleAdds lockdowndir havelsof largefilematcher delayadd cs = returnWhen (null
|
|||
| c = return otherchanges
|
||||
| otherwise = a
|
||||
|
||||
checksmall change =
|
||||
ifM (liftAnnex $ checkFileMatcher largefilematcher (toRawFilePath (changeFile change)))
|
||||
( return (Left change)
|
||||
, return (Right change)
|
||||
)
|
||||
checksmall change
|
||||
| not annexdotfiles && dotfile f =
|
||||
return (Right change)
|
||||
| otherwise =
|
||||
ifM (liftAnnex $ checkFileMatcher largefilematcher f)
|
||||
( return (Left change)
|
||||
, return (Right change)
|
||||
)
|
||||
where
|
||||
f = toRawFilePath (changeFile change)
|
||||
|
||||
addsmall [] = noop
|
||||
addsmall toadd = liftAnnex $ Annex.Queue.addCommand [] "add"
|
||||
|
|
|
@ -86,6 +86,8 @@ git-annex (10.20230408) UNRELEASED; urgency=medium
|
|||
* Speed up sync in an adjusted branch by avoiding re-adjusting the branch
|
||||
unncessarily, particularly when it is adjusted with --hide-missing
|
||||
or --unlock-present.
|
||||
* assistant: Add dotfiles to git by default, unless annex.dotfiles
|
||||
is configured, the same as git-annex add does.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Sat, 08 Apr 2023 13:57:18 -0400
|
||||
|
||||
|
|
|
@ -31,3 +31,5 @@ add .somedotfile ok
|
|||
|
||||
# End of transcript or log.
|
||||
"""]]
|
||||
|
||||
> [[fixed|done]] --[[Joey]]
|
||||
|
|
Loading…
Reference in a new issue