From 2c74780d475a2c9e60d8bf4d222bec7e15ca9dd6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 17 Feb 2017 15:21:39 -0400 Subject: sync hack to make updateInstead work on eg FAT sync: When syncing with a local repository located on a crippled filesystem, run the post-receive hook there, since it wouldn't get run otherwise. This makes pushing to repos on FAT-formatted removable drives update them when receive.denyCurrentBranch=updateInstead. Made Remote.Git export onLocal, which was cleaned up to not have so many caveats about its use. This commit was sponsored by Jeff Goeke-Smith on Patreon. --- Annex/UpdateInstead.hs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Annex/UpdateInstead.hs (limited to 'Annex') diff --git a/Annex/UpdateInstead.hs b/Annex/UpdateInstead.hs new file mode 100644 index 000000000..e31bcedaf --- /dev/null +++ b/Annex/UpdateInstead.hs @@ -0,0 +1,27 @@ +{- git-annex UpdateIntead emulation + - + - Copyright 2017 Joey Hess + - + - Licensed under the GNU GPL version 3 or higher. + -} + +module Annex.UpdateInstead where + +import qualified Annex +import Annex.Common +import Config +import Annex.Version +import Annex.AdjustedBranch +import Git.Branch +import Git.ConfigTypes + +{- receive.denyCurrentBranch=updateInstead does not work in direct mode + - repositories or when an adjusted branch is checked out, so must be + - emulated. -} +needUpdateInsteadEmulation :: Annex Bool +needUpdateInsteadEmulation = updateinsteadset <&&> (isDirect <||> isadjusted) + where + updateinsteadset = (== UpdateInstead) . receiveDenyCurrentBranch + <$> Annex.getGitConfig + isadjusted = versionSupportsUnlockedPointers + <&&> (maybe False (isJust . getAdjustment) <$> inRepo Git.Branch.current) -- cgit v1.2.3