diff --git a/CHANGELOG b/CHANGELOG index 91d3ca294d..d87fa5a3d3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,8 @@ git-annex (10.20241032) UNRELEASED; urgency=medium * vpop: Only update state after successful checkout. * add: Consistently treat files in a dotdir as dotfiles, even when ran inside that dotdir. + * add: When adding a dotfile as a non-large file, mention that it's a + dotfile. -- Joey Hess Mon, 11 Nov 2024 12:26:00 -0400 diff --git a/Command/Add.hs b/Command/Add.hs index ff60cd4370..ef5853126f 100644 --- a/Command/Add.hs +++ b/Command/Add.hs @@ -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 diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs index 6be663b949..7feb0b19eb 100644 --- a/Command/AddUrl.hs +++ b/Command/AddUrl.hs @@ -519,7 +519,7 @@ addWorkTree _ addunlockedmatcher u url file key mtmp = case mtmp of -- than the work tree file. liftIO $ moveFile file tmp go - else Command.Add.addSmall (DryRun False) file s + else Command.Add.addSmall False (DryRun False) file s >>= maybe noop void where go = do diff --git a/Command/Import.hs b/Command/Import.hs index c7496aeebf..f06543bb7e 100644 --- a/Command/Import.hs +++ b/Command/Import.hs @@ -261,7 +261,7 @@ startLocal o addunlockedmatcher largematcher mode (srcfile, destfile) = >>= maybe stop (\addedk -> next $ Command.Add.cleanup addedk True) - , Command.Add.addSmall (DryRun False) destfile s + , Command.Add.addSmall False (DryRun False) destfile s ) notoverwriting why = do warning $ "not overwriting existing " <> QuotedPath destfile <> " " <> UnquotedString why diff --git a/doc/bugs/keeps_adding_to_git_even_though_largerthan__61__.mdwn b/doc/bugs/keeps_adding_to_git_even_though_largerthan__61__.mdwn index 9925906fd9..b011766ae3 100644 --- a/doc/bugs/keeps_adding_to_git_even_though_largerthan__61__.mdwn +++ b/doc/bugs/keeps_adding_to_git_even_though_largerthan__61__.mdwn @@ -62,4 +62,4 @@ How to remedy? dandi project -> Not a bug, [[done]] --[[Joey]] +> [[fixed|done]] --[[Joey]] diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn index e0cae8c02b..178ad146d3 100644 --- a/doc/git-annex.mdwn +++ b/doc/git-annex.mdwn @@ -1009,8 +1009,8 @@ repository, using [[git-annex-config]]. See its man page for a list.) * `annex.addsmallfiles` - Controls whether small files (not matching annex.largefiles) - should be checked into git by `git annex add`. Defaults to true; + Controls whether small files (files not matching annex.largefiles, or + dotfiles) should be checked into git by `git annex add`. Defaults to true; set to false to instead make small files be skipped. * `annex.addunlocked`