Detect when the remote is broken like bitbucket is, and exits 0 when it fails to run git-annex-shell.
This commit is contained in:
parent
74712c20f1
commit
4b1cf3d731
3 changed files with 24 additions and 13 deletions
|
@ -136,21 +136,14 @@ guardUsable r onerr a
|
||||||
- returns the updated repo. -}
|
- returns the updated repo. -}
|
||||||
tryGitConfigRead :: Git.Repo -> Annex Git.Repo
|
tryGitConfigRead :: Git.Repo -> Annex Git.Repo
|
||||||
tryGitConfigRead r
|
tryGitConfigRead r
|
||||||
| not $ M.null $ Git.config r = return r -- already read
|
| haveconfig r = return r -- already read
|
||||||
| Git.repoIsSsh r = store $ do
|
| Git.repoIsSsh r = store $ do
|
||||||
v <- onRemote r (pipedsshconfig, Left undefined) "configlist" [] []
|
v <- onRemote r (pipedsshconfig, Left undefined) "configlist" [] []
|
||||||
case (v, Git.remoteName r) of
|
case v of
|
||||||
(Right r', _) -> return r'
|
Right r'
|
||||||
(Left _, Just n) -> do
|
| haveconfig r' -> return r'
|
||||||
{- Is this remote just not available, or does
|
| otherwise -> configlist_failed
|
||||||
- it not have git-annex-shell?
|
Left _ -> configlist_failed
|
||||||
- Find out by trying to fetch from the remote. -}
|
|
||||||
whenM (inRepo $ Git.Command.runBool [Param "fetch", Param "--quiet", Param n]) $ do
|
|
||||||
let k = "remote." ++ n ++ ".annex-ignore"
|
|
||||||
warning $ "Remote " ++ n ++ " does not have git-annex installed; setting " ++ k
|
|
||||||
inRepo $ Git.Command.run [Param "config", Param k, Param "true"]
|
|
||||||
return r
|
|
||||||
_ -> return r
|
|
||||||
| Git.repoIsHttp r = do
|
| Git.repoIsHttp r = do
|
||||||
headers <- getHttpHeaders
|
headers <- getHttpHeaders
|
||||||
store $ safely $ geturlconfig headers
|
store $ safely $ geturlconfig headers
|
||||||
|
@ -159,6 +152,8 @@ tryGitConfigRead r
|
||||||
ensureInitialized
|
ensureInitialized
|
||||||
Annex.getState Annex.repo
|
Annex.getState Annex.repo
|
||||||
where
|
where
|
||||||
|
haveconfig = not . M.null . Git.config
|
||||||
|
|
||||||
-- Reading config can fail due to IO error or
|
-- Reading config can fail due to IO error or
|
||||||
-- for other reasons; catch all possible exceptions.
|
-- for other reasons; catch all possible exceptions.
|
||||||
safely a = either (const $ return r) return
|
safely a = either (const $ return r) return
|
||||||
|
@ -200,6 +195,18 @@ tryGitConfigRead r
|
||||||
| otherwise =
|
| otherwise =
|
||||||
old : exchange ls new
|
old : exchange ls new
|
||||||
|
|
||||||
|
{- Is this remote just not available, or does
|
||||||
|
- it not have git-annex-shell?
|
||||||
|
- Find out by trying to fetch from the remote. -}
|
||||||
|
configlist_failed = case Git.remoteName r of
|
||||||
|
Nothing -> return r
|
||||||
|
Just n -> do
|
||||||
|
whenM (inRepo $ Git.Command.runBool [Param "fetch", Param "--quiet", Param n]) $ do
|
||||||
|
let k = "remote." ++ n ++ ".annex-ignore"
|
||||||
|
warning $ "Remote " ++ n ++ " does not have git-annex installed; setting " ++ k
|
||||||
|
inRepo $ Git.Command.run [Param "config", Param k, Param "true"]
|
||||||
|
return r
|
||||||
|
|
||||||
{- Checks if a given remote has the content for a key inAnnex.
|
{- Checks if a given remote has the content for a key inAnnex.
|
||||||
- If the remote cannot be accessed, or if it cannot determine
|
- If the remote cannot be accessed, or if it cannot determine
|
||||||
- whether it has the content, returns a Left error message.
|
- whether it has the content, returns a Left error message.
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -23,6 +23,8 @@ git-annex (4.20130418) UNRELEASED; urgency=low
|
||||||
* rmurl: New command, removes one of the recorded urls for a file.
|
* rmurl: New command, removes one of the recorded urls for a file.
|
||||||
* sync: Bug fix, avoid adding to the annex the
|
* sync: Bug fix, avoid adding to the annex the
|
||||||
dummy symlinks used on crippled filesystems.
|
dummy symlinks used on crippled filesystems.
|
||||||
|
* Detect when the remote is broken like bitbucket is, and exits 0 when
|
||||||
|
it fails to run git-annex-shell.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Thu, 18 Apr 2013 16:22:48 -0400
|
-- Joey Hess <joeyh@debian.org> Thu, 18 Apr 2013 16:22:48 -0400
|
||||||
|
|
||||||
|
|
|
@ -204,3 +204,5 @@ Here is the contents of .git/config (the last line was added by git annex sync)
|
||||||
fetch = +refs/heads/*:refs/remotes/aaatos/*
|
fetch = +refs/heads/*:refs/remotes/aaatos/*
|
||||||
annex-ignore = true
|
annex-ignore = true
|
||||||
"""]]
|
"""]]
|
||||||
|
|
||||||
|
> Reproduced and fixed. [[done]] --[[Joey]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue