From 2a966f49f2118356cc6f1a6ce55f8d368f89e4bc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 27 Feb 2023 14:35:27 -0400 Subject: [PATCH] overwrite old adjusted view branch When git-annex adjust is run in a view branch, and the adjusted branch already exists, overwrite the old adjusted branch with the new one without being forced. Usually overwriting an adjusted branch is avoided because it could lose data. But when a view branch has been adjusted, there is no data to lose in the adjusted branch, because the only changes that can be made of significance are to move files between directories. Which changes metadata on commit. And the old branch has already been committed. Sponsored-by: Lawrence Brogan on Patreon --- Annex/AdjustedBranch.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Annex/AdjustedBranch.hs b/Annex/AdjustedBranch.hs index af3d46aae6..1bc44ea2a2 100644 --- a/Annex/AdjustedBranch.hs +++ b/Annex/AdjustedBranch.hs @@ -1,6 +1,6 @@ {- adjusted branch - - - Copyright 2016-2020 Joey Hess + - Copyright 2016-2023 Joey Hess - - Licensed under the GNU AGPL version 3 or higher. -} @@ -67,6 +67,7 @@ import Annex.CurrentBranch import Types.CleanupActions import qualified Database.Keys import Config +import Logs.View (is_branchView) import qualified Data.Map as M @@ -207,7 +208,7 @@ enterAdjustedBranch adj = inRepo Git.Branch.current >>= \case go currbranch = do let origbranch = fromAdjustedBranch currbranch let adjbranch = adjBranch $ originalToAdjusted origbranch adj - ifM (inRepo (Git.Ref.exists adjbranch) <&&> (not <$> Annex.getRead Annex.force)) + ifM (inRepo (Git.Ref.exists adjbranch) <&&> (not <$> Annex.getRead Annex.force) <&&> pure (not (is_branchView origbranch))) ( do mapM_ (warning . unwords) [ [ "adjusted branch" -- 2.30.2