fix update a submission when using git-annex

This commit is contained in:
Filip Graliński 2018-06-06 12:58:50 +02:00
parent 85c9ad6646
commit 92c0927dca

View File

@ -130,24 +130,23 @@ updateRepo repoId chan = do
repo <- runDB $ get404 repoId repo <- runDB $ get404 repoId
repoDir <- getRepoDir repoId repoDir <- getRepoDir repoId
let branch = repoBranch repo let branch = repoBranch repo
(exitCode, _) <- runProgram (Just repoDir) gitPath ["fetch", exitCode <- runWithChannel chan $ do
"origin", runProg (Just repoDir) gitPath ["fetch",
T.unpack branch, "origin",
"--progress"] chan T.unpack branch,
"--progress"]
runProg (Just repoDir) gitPath ["reset",
"--hard",
"FETCH_HEAD"]
getStuffUsingGitAnnex repoDir (repoGitAnnexRemote repo)
case exitCode of case exitCode of
ExitSuccess -> do ExitSuccess -> do
(exitCode, _) <- runProgram (Just repoDir) gitPath ["reset", maybeHeadCommit <- getHeadCommit repoDir chan
"--hard", case maybeHeadCommit of
"FETCH_HEAD"] chan
case exitCode of
ExitSuccess -> do
maybeHeadCommit <- getHeadCommit repoDir chan
case maybeHeadCommit of
Just headCommit -> do Just headCommit -> do
runDB $ update repoId [RepoCurrentCommit =. headCommit] runDB $ update repoId [RepoCurrentCommit =. headCommit]
return True return True
Nothing -> return False Nothing -> return False
_ -> return False
_ -> return False _ -> return False
getHeadCommit :: FilePath -> Channel -> Handler (Maybe SHA1) getHeadCommit :: FilePath -> Channel -> Handler (Maybe SHA1)