Improve error message when --in @date is used and there is no reflog for the git-annex branch.
This commit is contained in:
parent
f0ff3a08ea
commit
3af4691978
4 changed files with 23 additions and 7 deletions
|
@ -38,6 +38,7 @@ import Annex.Index
|
||||||
import qualified Git
|
import qualified Git
|
||||||
import qualified Git.Command
|
import qualified Git.Command
|
||||||
import qualified Git.Ref
|
import qualified Git.Ref
|
||||||
|
import qualified Git.RefLog
|
||||||
import qualified Git.Sha
|
import qualified Git.Sha
|
||||||
import qualified Git.Branch
|
import qualified Git.Branch
|
||||||
import qualified Git.UnionMerge
|
import qualified Git.UnionMerge
|
||||||
|
@ -205,7 +206,13 @@ getRaw :: FilePath -> Annex String
|
||||||
getRaw = getRef fullname
|
getRaw = getRef fullname
|
||||||
|
|
||||||
getHistorical :: RefDate -> FilePath -> Annex String
|
getHistorical :: RefDate -> FilePath -> Annex String
|
||||||
getHistorical date = getRef (Git.Ref.dateRef fullname date)
|
getHistorical date file =
|
||||||
|
-- This check avoids some ugly error messages when the reflog
|
||||||
|
-- is empty.
|
||||||
|
ifM (null <$> inRepo (Git.RefLog.get' [Param "-n1"] fullname))
|
||||||
|
( error ("No reflog for " ++ fromRef fullname)
|
||||||
|
, getRef (Git.Ref.dateRef fullname date) file
|
||||||
|
)
|
||||||
|
|
||||||
getRef :: Ref -> FilePath -> Annex String
|
getRef :: Ref -> FilePath -> Annex String
|
||||||
getRef ref file = withIndex $ decodeBS <$> catFile ref file
|
getRef ref file = withIndex $ decodeBS <$> catFile ref file
|
||||||
|
|
|
@ -14,9 +14,14 @@ import Git.Sha
|
||||||
|
|
||||||
{- Gets the reflog for a given branch. -}
|
{- Gets the reflog for a given branch. -}
|
||||||
get :: Branch -> Repo -> IO [Sha]
|
get :: Branch -> Repo -> IO [Sha]
|
||||||
get b = mapMaybe extractSha . lines <$$> pipeReadStrict
|
get = get' []
|
||||||
[ Param "log"
|
|
||||||
, Param "-g"
|
get' :: [CommandParam] -> Branch -> Repo -> IO [Sha]
|
||||||
, Param "--format=%H"
|
get' ps b = mapMaybe extractSha . lines <$$> pipeReadStrict ps'
|
||||||
, Param (fromRef b)
|
where
|
||||||
]
|
ps' =
|
||||||
|
[ Param "log"
|
||||||
|
, Param "-g"
|
||||||
|
, Param "--format=%H"
|
||||||
|
, Param (fromRef b)
|
||||||
|
] ++ ps
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -12,6 +12,8 @@ git-annex (5.20150318) UNRELEASED; urgency=medium
|
||||||
* --auto is no longer a global option; only get, drop, and copy
|
* --auto is no longer a global option; only get, drop, and copy
|
||||||
accept it. (Not a behavior change unless you were passing it to a
|
accept it. (Not a behavior change unless you were passing it to a
|
||||||
command that ignored it.)
|
command that ignored it.)
|
||||||
|
* Improve error message when --in @date is used and there is no
|
||||||
|
reflog for the git-annex branch.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Thu, 19 Mar 2015 17:05:32 -0400
|
-- Joey Hess <id@joeyh.name> Thu, 19 Mar 2015 17:05:32 -0400
|
||||||
|
|
||||||
|
|
|
@ -31,3 +31,5 @@ git-annex: fd:9: hFlush: resource vanished (Broken pipe)
|
||||||
|
|
||||||
# End of transcript or log.
|
# End of transcript or log.
|
||||||
"""]]
|
"""]]
|
||||||
|
|
||||||
|
> [[fixed|done]] --[[Joey]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue