use programPath consistently, not readProgramFile
Improve git-annex's ability to find the path to its program, especially when it needs to run itself in another repo to upgrade it. Some parts of the code used readProgramFile, probably because I forgot that programPath exists. I noticed this when a git-annex auto-upgrade failed because it was running git-annex upgrade --autoonly, but the code to run git-annex used readProgramFile, which happened to point to an older build of git-annex.
This commit is contained in:
parent
f83ead0240
commit
87d5583a91
8 changed files with 38 additions and 31 deletions
|
@ -61,27 +61,6 @@ removeAutoStartFile path = do
|
|||
programFile :: IO FilePath
|
||||
programFile = userConfigFile "program"
|
||||
|
||||
{- Returns a command to run for git-annex. -}
|
||||
readProgramFile :: IO FilePath
|
||||
readProgramFile = do
|
||||
programfile <- programFile
|
||||
p <- catchDefaultIO cmd $
|
||||
fromMaybe cmd . headMaybe . lines <$> readFile programfile
|
||||
ifM (inPath p)
|
||||
( return p
|
||||
, ifM (inPath cmd)
|
||||
( return cmd
|
||||
, cannotFindProgram
|
||||
)
|
||||
)
|
||||
where
|
||||
cmd = "git-annex"
|
||||
|
||||
cannotFindProgram :: IO a
|
||||
cannotFindProgram = do
|
||||
f <- programFile
|
||||
giveup $ "cannot find git-annex program in PATH or in the location listed in " ++ f
|
||||
|
||||
{- A .noannex file in a git repository prevents git-annex from
|
||||
- initializing that repository.. The content of the file is returned. -}
|
||||
noAnnexFileContent :: Maybe FilePath -> IO (Maybe String)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue