add: When adding a dotfile as a non-large file, mention that it's a dotfile
This is to reduce user confusion when their annex.largefiles matches it,
or is not set.
Note that, when annex.dotfiles is set, but a dotfile is not matched by
annex.largefiles, the "non-large file" message will be displayed. That
makes sense because whether the file is a dotfile does not matter with that
configuration.
Also, this slightly optimised the annex.dotfiles path in passing,
by avoiding the slight slowdown caused by the check added in commit
876d5b6c6f
in that case.
This commit is contained in:
parent
876d5b6c6f
commit
b94221594b
6 changed files with 24 additions and 19 deletions
|
@ -95,18 +95,20 @@ seek' o = do
|
|||
annexdotfiles <- getGitConfigVal annexDotFiles
|
||||
let gofile includingsmall (si, file) = case largeFilesOverride o of
|
||||
Nothing -> do
|
||||
topfile <- getTopFilePath <$> inRepo (toTopFilePath file)
|
||||
ifM (pure (annexdotfiles || not (dotfile topfile))
|
||||
<&&> (checkFileMatcher NoLiveUpdate largematcher file
|
||||
<||> Annex.getRead Annex.force))
|
||||
( start dr si file addunlockedmatcher
|
||||
, if includingsmall
|
||||
isdotfile <- if annexdotfiles
|
||||
then pure False
|
||||
else dotfile . getTopFilePath
|
||||
<$> inRepo (toTopFilePath file)
|
||||
islarge <- checkFileMatcher NoLiveUpdate largematcher file
|
||||
<||> Annex.getRead Annex.force
|
||||
if (not isdotfile && islarge)
|
||||
then start dr si file addunlockedmatcher
|
||||
else if includingsmall
|
||||
then ifM (annexAddSmallFiles <$> Annex.getGitConfig)
|
||||
( startSmall dr si file
|
||||
( startSmall isdotfile dr si file
|
||||
, stop
|
||||
)
|
||||
else stop
|
||||
)
|
||||
Just True -> start dr si file addunlockedmatcher
|
||||
Just False -> startSmallOverridden dr si file
|
||||
case batchOption o of
|
||||
|
@ -138,17 +140,18 @@ seek' o = do
|
|||
dr = dryRunOption o
|
||||
|
||||
{- Pass file off to git-add. -}
|
||||
startSmall :: DryRun -> SeekInput -> RawFilePath -> CommandStart
|
||||
startSmall dr si file =
|
||||
startSmall :: Bool -> DryRun -> SeekInput -> RawFilePath -> CommandStart
|
||||
startSmall isdotfile dr si file =
|
||||
liftIO (catchMaybeIO $ R.getSymbolicLinkStatus file) >>= \case
|
||||
Just s ->
|
||||
starting "add" (ActionItemTreeFile file) si $
|
||||
addSmall dr file s
|
||||
addSmall isdotfile dr file s
|
||||
Nothing -> stop
|
||||
|
||||
addSmall :: DryRun -> RawFilePath -> FileStatus -> CommandPerform
|
||||
addSmall dr file s = do
|
||||
showNote "non-large file; adding content to git repository"
|
||||
addSmall :: Bool -> DryRun -> RawFilePath -> FileStatus -> CommandPerform
|
||||
addSmall isdotfile dr file s = do
|
||||
showNote $ (if isdotfile then "dotfile" else "non-large file")
|
||||
<> "; adding content to git repository"
|
||||
skipWhenDryRun dr $ next $ addFile Small file s
|
||||
|
||||
startSmallOverridden :: DryRun -> SeekInput -> RawFilePath -> CommandStart
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue