diff --git a/Annex/Import.hs b/Annex/Import.hs index 023d7df1a9..5c9ac2eaaf 100644 --- a/Annex/Import.hs +++ b/Annex/Import.hs @@ -223,20 +223,27 @@ buildImportCommit' remote importcommitconfig mtrackingcommit imported@(History t -- nothing new needs to be committed. -- (This is unlikely to happen.) | sametodepth h' = return Nothing - | otherwise = do - importedcommit <- case getRemoteTrackingBranchImportHistory h of - Nothing -> mkcommitsunconnected imported - Just oldimported@(History oldhc _) - | importeddepth == 1 -> - mkcommitconnected imported oldimported - | otherwise -> do - let oldimportedtrees = mapHistory historyCommitTree oldimported - mknewcommits oldhc oldimportedtrees imported - ti' <- addBackExportExcluded remote ti - Just <$> makeRemoteTrackingBranchMergeCommit' - trackingcommit importedcommit ti' + -- If the imported tree is unchanged, + -- nothing new needs to be committed. + | otherwise = getLastImportedTree remote >>= \case + Just (LastImportedTree lasttree) + | lasttree == ti -> return Nothing + _ -> gencommit trackingcommit h where h'@(History t s) = mapHistory historyCommitTree h + + gencommit trackingcommit h = do + importedcommit <- case getRemoteTrackingBranchImportHistory h of + Nothing -> mkcommitsunconnected imported + Just oldimported@(History oldhc _) + | importeddepth == 1 -> + mkcommitconnected imported oldimported + | otherwise -> do + let oldimportedtrees = mapHistory historyCommitTree oldimported + mknewcommits oldhc oldimportedtrees imported + ti' <- addBackExportExcluded remote ti + Just <$> makeRemoteTrackingBranchMergeCommit' + trackingcommit importedcommit ti' importeddepth = historyDepth imported diff --git a/CHANGELOG b/CHANGELOG index bb874441e5..c632bef4fb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ git-annex (10.20231228) UNRELEASED; urgency=medium * info: Added "annex sizes of repositories" table to the overall display. + * import: Sped up import from special remote when the imported tree is + unchanged. -- Joey Hess Fri, 29 Dec 2023 11:52:06 -0400