diff options
author | Joey Hess <joey@kitenet.net> | 2013-09-12 15:54:35 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-09-12 15:54:35 -0400 |
commit | b2ffbaf43ca2773e51ff2d5665db67f86f8ccdd7 (patch) | |
tree | 5b98d88bf1cbaf9e0d41458f6b9469f1895d6bdf /Config.hs | |
parent | 4515c27f4273969ef2fae1dc0f90dbe98a905eae (diff) |
Support hot-swapping of removable drives containing gcrypt repositories.
To support this, a core.gcrypt-id is stored by git-annex inside the git
config of a local gcrypt repository, when setting it up.
That is compared with the remote's cached gcrypt-id. When different, a
drive has been changed. git-annex then looks up the remote config for
the uuid mapped from the core.gcrypt-id, and tweaks the configuration
appropriately. When there is no known config for the uuid, it will refuse to
use the remote.
Diffstat (limited to 'Config.hs')
-rw-r--r-- | Config.hs | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -36,8 +36,11 @@ setConfig (ConfigKey key) value = do {- Unsets a git config setting. (Leaves it in state currently.) -} unsetConfig :: ConfigKey -> Annex () -unsetConfig (ConfigKey key) = inRepo $ Git.Command.run - [Param "config", Param "--unset", Param key] +unsetConfig ck@(ConfigKey key) = ifM (isJust <$> getConfigMaybe ck) + ( inRepo $ Git.Command.run + [Param "config", Param "--unset", Param key] + , noop -- avoid unsetting something not set; that would fail + ) {- A per-remote config setting in git config. -} remoteConfig :: Git.Repo -> UnqualifiedConfigKey -> ConfigKey |