diff options
author | Joey Hess <joey@kitenet.net> | 2013-10-27 16:42:13 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-10-27 16:42:13 -0400 |
commit | be581a2722e78f8a2e59e5ca78a1090efc432307 (patch) | |
tree | a24cb16a152bcce74bf4ae279056ac1f17ab4695 /Remote.hs | |
parent | 4b0b07f1783705714dd75ca1812ab676260e5728 (diff) |
automatically launch git repository repair
Added a RemoteChecker thread, that waits for problems to be reported with
remotes, and checks if their git repository is in need of repair.
Currently, only failures to sync with the remote cause a problem to be
reported. This seems enough, but we'll see.
Plugging in a removable drive with a repository on it that is corrupted
does automatically repair the repository, as long as the corruption causes
git push or git pull to fail. Some types of corruption do not, eg
missing/corrupt objects for blobs that git push doesn't need to look at.
So, this is not really a replacement for scheduled git repository fscking.
But it does make the assistant more robust.
This commit is sponsored by Fernando Jimenez.
Diffstat (limited to 'Remote.hs')
-rw-r--r-- | Remote.hs | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -39,7 +39,8 @@ module Remote ( showTriedRemotes, showLocations, forceTrust, - logStatus + logStatus, + checkAvailable ) where import qualified Data.Map as M @@ -274,3 +275,7 @@ byCost = map snd . sortBy (comparing fst) . M.toList . costmap where costmap = M.fromListWith (++) . map costpair costpair r = (cost r, [r]) + +checkAvailable :: Bool -> Remote -> IO Bool +checkAvailable assumenetworkavailable = + maybe (return assumenetworkavailable) doesDirectoryExist . localpath |