summaryrefslogtreecommitdiff
path: root/Git.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-26 17:15:17 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-26 17:22:44 -0400
commit7e62e57f8c9ea49250399f385ee898667df80800 (patch)
tree47319d3f40691b87e76751efc5b634a01cf8680c /Git.hs
parenta7b8c807d9ea101e36ca4175781e68d641413bea (diff)
Avoid ugly failure mode when moving content from a local repository that is not available.
Prelude.undefined error message was introduced by bb4f31a0ee496ffb83d31cc56f8827e47605d763. It seems best to filter out local repositories that cannot be accessed from the list of remotes, rather than keeping them in and making every thing that uses the list have to deal with remotes that may have an unknown location. Besides fixing the error message, this also makes unavailable local remotes' names not be shown in various messages, including in git annex status output. Also, move --to an unavailable local repository now avoids some ugly errors like "changeWorkingDirectory: does not exist".
Diffstat (limited to 'Git.hs')
-rw-r--r--Git.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Git.hs b/Git.hs
index 7d6420563..eab33f19d 100644
--- a/Git.hs
+++ b/Git.hs
@@ -19,6 +19,7 @@ module Git (
repoIsHttp,
repoIsLocal,
repoIsLocalBare,
+ repoIsLocalUnknown,
repoDescribe,
repoLocation,
repoPath,
@@ -99,6 +100,10 @@ repoIsLocalBare :: Repo -> Bool
repoIsLocalBare Repo { location = Local { worktree = Nothing } } = True
repoIsLocalBare _ = False
+repoIsLocalUnknown :: Repo -> Bool
+repoIsLocalUnknown Repo { location = LocalUnknown { } } = True
+repoIsLocalUnknown _ = False
+
assertLocal :: Repo -> a -> a
assertLocal repo action
| repoIsUrl repo = error $ unwords