summaryrefslogtreecommitdiff
path: root/Types
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2018-10-25 17:23:53 -0400
committerJoey Hess <joeyh@joeyh.name>2018-10-25 18:24:23 -0400
commit234842a347512751c15ce727ad5c316ef88ab5a7 (patch)
tree81a731557af7363ac52a0ca9d5957a6692f52a8b /Types
parent6ceeb4bae71a8711b60c238ffc418292312ae9d2 (diff)
v7
Install new git hooks in this version. This does beg the question of what to do if git later gets eg a post-smudge hook, that could run git-annex smudge --update. I think the thing to do in that case would be to make git-annex smudge --update install the new hooks. That way, as the user uses git-annex, the hook would be created pretty quickly and without needing any extra syscalls except for when git-annex smudge --update is called. I considered doing something like that for installation of the post-checkout and post-merge hooks, which would have avoided the need for v7. But the only place it was cheap to do it would be in git-annex smudge which could cheaply notice that smudge.log didn't exist yet and so know the hooks needed to be installed. But since smudge used to populate pointer files, it would be quite surprising if a single git checkout/merge failed to update the work tree, and so that idea didn't work out. The other reason for v7 is psychological -- users don't need to worry about whether they might be running an old version of git-annex that doesn't support their v7 repository very well. And bug reports about "v6" have gotten a bit of a bad association in my head since they often hit one of the known limitations and didn't realize it was experimental. newtyped RepoVersion Int to avoid needing 2 comparisons in versionSupportsUnlockedPointers etc. Also it's just nicer. This commit was sponsored by John Pellman on Patreon.
Diffstat (limited to 'Types')
-rw-r--r--Types/GitConfig.hs5
-rw-r--r--Types/RepoVersion.hs11
2 files changed, 14 insertions, 2 deletions
diff --git a/Types/GitConfig.hs b/Types/GitConfig.hs
index 63e0d77f4e..2dc922569f 100644
--- a/Types/GitConfig.hs
+++ b/Types/GitConfig.hs
@@ -30,6 +30,7 @@ import Types.Concurrency
import Types.NumCopies
import Types.Difference
import Types.RefSpec
+import Types.RepoVersion
import Config.DynamicConfig
import Utility.HumanTime
import Utility.Gpg (GpgCmd, mkGpgCmd)
@@ -52,7 +53,7 @@ data Configurable a
{- Main git-annex settings. Each setting corresponds to a git-config key
- such as annex.foo -}
data GitConfig = GitConfig
- { annexVersion :: Maybe String
+ { annexVersion :: Maybe RepoVersion
, annexUUID :: UUID
, annexNumCopies :: Maybe NumCopies
, annexDiskReserve :: Integer
@@ -110,7 +111,7 @@ data GitConfig = GitConfig
extractGitConfig :: Git.Repo -> GitConfig
extractGitConfig r = GitConfig
- { annexVersion = notempty $ getmaybe (annex "version")
+ { annexVersion = RepoVersion <$> getmayberead (annex "version")
, annexUUID = maybe NoUUID toUUID $ getmaybe (annex "uuid")
, annexNumCopies = NumCopies <$> getmayberead (annex "numcopies")
, annexDiskReserve = fromMaybe onemegabyte $
diff --git a/Types/RepoVersion.hs b/Types/RepoVersion.hs
new file mode 100644
index 0000000000..e79d5b21c8
--- /dev/null
+++ b/Types/RepoVersion.hs
@@ -0,0 +1,11 @@
+{- git-annex repository versioning
+ -
+ - Copyright 2010-2018 Joey Hess <id@joeyh.name>
+ -
+ - Licensed under the GNU AGPL version 3 or higher.
+ -}
+
+module Types.RepoVersion where
+
+newtype RepoVersion = RepoVersion { fromRepoVersion :: Int }
+ deriving (Eq, Ord, Read, Show)