on master help sign in
Use thunkSourceToGitSource in more places
commit9f01811e9055507dc61f5dbb087ccaa7e16a609a authorTom Smalley <tfsmalley@gmail.com> dateThu 16 Apr 2020, 19:42 (6 years ago) parentdea6842
1 file changed+6−11
lib/command/src/Obelisk/Command/Thunk.hs+6−11
lib/command/src/Obelisk/Command/Thunk.hs+6−11
@@ -468,11 +468,7 @@ updateThunkToLatest (ThunkUpdateConfig mBranch thunkConfig) target = spinner $ d
468468 Just branch -> readThunk target >>= \case
469469 Left err -> failWith [i|Thunk update: ${err}|]
470470 Right c -> case c of
471− ThunkData_Packed _ t -> case _thunkPtr_source t of
472− ThunkSource_Git tsg -> setThunk thunkConfig target tsg branch
473− ThunkSource_GitHub tsgh -> do
474− let tsg = forgetGithub False tsgh
475− setThunk thunkConfig target tsg branch
471+ ThunkData_Packed _ t -> setThunk thunkConfig target (thunkSourceToGitSource $ _thunkPtr_source t) branch
476472 ThunkData_Checkout -> failWith [i|Thunk located at ${target} is unpacked. Use 'ob thunk pack' on the desired directory and then try 'ob thunk update' again.|]
477473 where
478474 spinner = withSpinner' ("Updating thunk " <> T.pack target <> " to latest") (pure $ const $ "Thunk " <> T.pack target <> " updated to latest")
@@ -803,9 +799,10 @@ unpackThunk' noTrail thunkDir = checkThunkDirectory thunkDir *> readThunk thunkD
803799 let (thunkParent, thunkName) = splitFileName thunkDir
804800 withTempDirectory thunkParent thunkName $ \tmpThunk -> do
805801 let
806− (gitSrc, newSpec) = case _thunkPtr_source tptr of
807− ThunkSource_GitHub s' -> (forgetGithub False s', NonEmpty.head gitHubThunkSpecs)
808− ThunkSource_Git s' -> (s', NonEmpty.head gitThunkSpecs)
802+ gitSrc = thunkSourceToGitSource $ _thunkPtr_source tptr
803+ newSpec = case _thunkPtr_source tptr of
804+ ThunkSource_GitHub _ -> NonEmpty.head gitHubThunkSpecs
805+ ThunkSource_Git _ -> NonEmpty.head gitThunkSpecs
809806 withSpinner' ("Fetching thunk " <> T.pack thunkName)
810807 (finalMsg noTrail $ const $ "Fetched thunk " <> T.pack thunkName) $ do
811808 gitCloneForThunkUnpack gitSrc (_thunkRev_commit $ _thunkPtr_rev tptr) (tmpThunk </> unpackedDirName)
@@ -994,9 +991,7 @@ getThunkPtr gitCheckClean dir mPrivate = do
994991-- | Get the latest revision available from the given source
995992getLatestRev :: MonadObelisk m => ThunkSource -> m ThunkRev
996993getLatestRev os = do
997− let gitS = case os of
998− ThunkSource_GitHub s -> forgetGithub False s
999− ThunkSource_Git s -> s
994+ let gitS = thunkSourceToGitSource os
1000995 (_, commit) <- gitGetCommitBranch (_gitSource_url gitS) (untagName <$> _gitSource_branch gitS)
1001996 case os of
1002997 ThunkSource_GitHub s -> githubThunkRev s commit