diff options
author | 2013-04-23 20:06:02 -0400 | |
---|---|---|
committer | 2013-04-23 20:06:02 -0400 | |
commit | 22c77acb85aa7dffa52d28f7ff84b64b75f5b621 (patch) | |
tree | 631d1c390cafa5e49ecb02c491dec1de06b46bf6 | |
parent | d4343da8277a208e1a3eaed10e1a9f5096bfcd39 (diff) |
Detect when the remote is broken like bitbucket is, and exits 0 when it fails to run git-annex-shell.
-rw-r--r-- | Remote/Git.hs | 33 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | doc/bugs/call_to_git-annex-shell_when_on_centralised___40__non-git-annex__41___repository.mdwn | 2 |
3 files changed, 24 insertions, 13 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs index 4110c1491..752d70d23 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -136,21 +136,14 @@ guardUsable r onerr a - returns the updated repo. -} tryGitConfigRead :: Git.Repo -> Annex Git.Repo tryGitConfigRead r - | not $ M.null $ Git.config r = return r -- already read + | haveconfig r = return r -- already read | Git.repoIsSsh r = store $ do v <- onRemote r (pipedsshconfig, Left undefined) "configlist" [] [] - case (v, Git.remoteName r) of - (Right r', _) -> return r' - (Left _, Just n) -> do - {- Is this remote just not available, or does - - it not have git-annex-shell? - - 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 + case v of + Right r' + | haveconfig r' -> return r' + | otherwise -> configlist_failed + Left _ -> configlist_failed | Git.repoIsHttp r = do headers <- getHttpHeaders store $ safely $ geturlconfig headers @@ -159,6 +152,8 @@ tryGitConfigRead r ensureInitialized Annex.getState Annex.repo where + haveconfig = not . M.null . Git.config + -- Reading config can fail due to IO error or -- for other reasons; catch all possible exceptions. safely a = either (const $ return r) return @@ -200,6 +195,18 @@ tryGitConfigRead r | otherwise = 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. - If the remote cannot be accessed, or if it cannot determine - whether it has the content, returns a Left error message. diff --git a/debian/changelog b/debian/changelog index fa4c5cfb7..24443a685 100644 --- a/debian/changelog +++ b/debian/changelog @@ -23,6 +23,8 @@ git-annex (4.20130418) UNRELEASED; urgency=low * rmurl: New command, removes one of the recorded urls for a file. * sync: Bug fix, avoid adding to the annex the 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 diff --git a/doc/bugs/call_to_git-annex-shell_when_on_centralised___40__non-git-annex__41___repository.mdwn b/doc/bugs/call_to_git-annex-shell_when_on_centralised___40__non-git-annex__41___repository.mdwn index c74a7ed20..2a2832da3 100644 --- a/doc/bugs/call_to_git-annex-shell_when_on_centralised___40__non-git-annex__41___repository.mdwn +++ b/doc/bugs/call_to_git-annex-shell_when_on_centralised___40__non-git-annex__41___repository.mdwn @@ -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/* annex-ignore = true """]] + +> Reproduced and fixed. [[done]] --[[Joey]] |