Minor refactor in cloning code
This commit is contained in:
parent
c028e4b6cc
commit
7311a2a012
@ -241,9 +241,8 @@ getPossiblyExistingRepo checkRepo userId challengeId repoSpec chan = do
|
|||||||
}
|
}
|
||||||
cloneRepo' userId repoCloningSpec chan
|
cloneRepo' userId repoCloningSpec chan
|
||||||
|
|
||||||
|
cloneRepoToTempDir :: RepoCloningSpec -> Channel -> Handler (ExitCode, FilePath)
|
||||||
cloneRepo' :: UserId -> RepoCloningSpec -> Channel -> Handler (Maybe (Key Repo))
|
cloneRepoToTempDir repoCloningSpec chan = do
|
||||||
cloneRepo' userId repoCloningSpec chan = do
|
|
||||||
let url = repoSpecUrl $ cloningSpecRepo repoCloningSpec
|
let url = repoSpecUrl $ cloningSpecRepo repoCloningSpec
|
||||||
msg chan $ concat ["Preparing to clone repo ", url]
|
msg chan $ concat ["Preparing to clone repo ", url]
|
||||||
msg chan "Cloning..."
|
msg chan "Cloning..."
|
||||||
@ -251,6 +250,12 @@ cloneRepo' userId repoCloningSpec chan = do
|
|||||||
arenaDir <- arena
|
arenaDir <- arena
|
||||||
let tmpRepoDir = arenaDir </> ("t" ++ show r)
|
let tmpRepoDir = arenaDir </> ("t" ++ show r)
|
||||||
exitCode <- rawClone tmpRepoDir repoCloningSpec chan
|
exitCode <- rawClone tmpRepoDir repoCloningSpec chan
|
||||||
|
return (exitCode, tmpRepoDir)
|
||||||
|
|
||||||
|
cloneRepo' :: UserId -> RepoCloningSpec -> Channel -> Handler (Maybe (Key Repo))
|
||||||
|
cloneRepo' userId repoCloningSpec chan = do
|
||||||
|
let url = repoSpecUrl $ cloningSpecRepo repoCloningSpec
|
||||||
|
(exitCode, tmpRepoDir) <- cloneRepoToTempDir repoCloningSpec chan
|
||||||
case exitCode of
|
case exitCode of
|
||||||
ExitSuccess -> do
|
ExitSuccess -> do
|
||||||
maybeHeadCommit <- getHeadCommit tmpRepoDir chan
|
maybeHeadCommit <- getHeadCommit tmpRepoDir chan
|
||||||
|
Loading…
Reference in New Issue
Block a user