on master help sign in
command: Clean up minor lint
7c40bddElliot Cameron
lib/command/src/Obelisk/Command/Thunk.hs+8−10
@@ -402,7 +402,7 @@ updateThunkToLatest target mBranch = withSpinner' ("Updating thunk " <> T.pack t
402 ThunkSource_GitHub tsgh -> do
402 ThunkSource_GitHub tsgh -> do
403 let tsg = forgetGithub False tsgh
403 let tsg = forgetGithub False tsgh
404 setThunk target tsg branch
404 setThunk target tsg branch
405− ThunkData_Checkout _ -> failWith $ T.pack $ "thunk located at " <> (show target) <> " is unpacked. Use ob thunk pack on the desired directory and then try ob thunk update again."
405+ ThunkData_Checkout _ -> failWith $ T.pack $ "thunk located at " <> show target <> " is unpacked. Use ob thunk pack on the desired directory and then try ob thunk update again."
406
406
407setThunk :: MonadObelisk m => FilePath -> GitSource -> String -> m ()
407setThunk :: MonadObelisk m => FilePath -> GitSource -> String -> m ()
408setThunk target gs branch = do
408setThunk target gs branch = do
@@ -570,7 +570,7 @@ updateThunk p f = withSystemTempDirectory "obelisk-thunkptr-" $ \tmpDir -> do
570 callProcessAndLogOutput (Notice, Error) $
570 callProcessAndLogOutput (Notice, Error) $
571 proc "cp" ["-r", "-T", thunkDir, tmpThunk]
571 proc "cp" ["-r", "-T", thunkDir, tmpThunk]
572 return tmpThunk
572 return tmpThunk
573− Right _ -> failWith $ "Thunk is not packed"
573+ Right _ -> failWith "Thunk is not packed"
574 updateThunkFromTmp p' = do
574 updateThunkFromTmp p' = do
575 _ <- packThunk' True False p'
575 _ <- packThunk' True False p'
576 callProcessAndLogOutput (Notice, Error) $
576 callProcessAndLogOutput (Notice, Error) $
@@ -639,7 +639,7 @@ packThunk' noTrail force thunkDir = checkThunkDirectory "Can't pack/unpack from
639
639
640getThunkPtr :: forall m. MonadObelisk m => Bool -> FilePath -> m ThunkPtr
640getThunkPtr :: forall m. MonadObelisk m => Bool -> FilePath -> m ThunkPtr
641getThunkPtr checkClean thunkDir = do
641getThunkPtr checkClean thunkDir = do
642− when checkClean $ ensureCleanGitRepo thunkDir True $
642+ when checkClean $ ensureCleanGitRepo thunkDir True
643 "thunk pack: thunk checkout contains unsaved modifications"
643 "thunk pack: thunk checkout contains unsaved modifications"
644
644
645 -- Check whether there are any stashes
645 -- Check whether there are any stashes
@@ -733,7 +733,7 @@ getThunkPtr checkClean thunkDir = do
733 [ "thunk pack: Certain branches in the thunk have commits not yet pushed upstream:"
733 [ "thunk pack: Certain branches in the thunk have commits not yet pushed upstream:"
734 , ""
734 , ""
735 ] ++
735 ] ++
736− (flip map (Map.toList nonGood) $ \(branch, (upstream, (ahead, behind))) -> mconcat
736+ flip map (Map.toList nonGood) (\(branch, (upstream, (ahead, behind))) -> mconcat
737 [" ", branch, " ahead: ", T.pack (show ahead), " behind: ", T.pack (show behind), " remote branch ", upstream]) ++
737 [" ", branch, " ahead: ", T.pack (show ahead), " behind: ", T.pack (show behind), " remote branch ", upstream]) ++
738 [ ""
738 [ ""
739 , "Please push these upstream and try again. (Or just fetch, if they are somehow \
739 , "Please push these upstream and try again. (Or just fetch, if they are somehow \
@@ -741,7 +741,7 @@ getThunkPtr checkClean thunkDir = do
741 ]
741 ]
742
742
743 -- We assume it's safe to pack the thunk at this point
743 -- We assume it's safe to pack the thunk at this point
744− putLog Informational $ "All changes safe in git remotes. OK to pack thunk."
744+ putLog Informational "All changes safe in git remotes. OK to pack thunk."
745
745
746 let remote = maybe "origin" snd $ flip Map.lookup headUpstream =<< mCurrentBranch
746 let remote = maybe "origin" snd $ flip Map.lookup headUpstream =<< mCurrentBranch
747
747
@@ -784,7 +784,7 @@ uriThunkPtr uri mbranch mcommit = do
784 case rev of
784 case rev of
785 Right r -> pure (ThunkSource_GitHub s, r)
785 Right r -> pure (ThunkSource_GitHub s, r)
786 Left e -> do
786 Left e -> do
787− putLog Warning $ "\
787+ putLog Warning "\
788\Failed to fetch archive from GitHub. This is probably a private repo. \
788\Failed to fetch archive from GitHub. This is probably a private repo. \
789\Falling back on normal fetchgit. Original failure:"
789\Falling back on normal fetchgit. Original failure:"
790 errorToWarning e
790 errorToWarning e
@@ -818,9 +818,7 @@ uriToThunkSource u
818 { _gitHubSource_owner = N $ unRText owner
818 { _gitHubSource_owner = N $ unRText owner
819 , _gitHubSource_repo = N $ let
819 , _gitHubSource_repo = N $ let
820 repoish' = unRText repoish
820 repoish' = unRText repoish
821− in case T.stripSuffix ".git" repoish' of
821+ in fromMaybe repoish' $ T.stripSuffix ".git" repoish'
822− Just repo -> repo
823− Nothing -> repoish'
824 , _gitHubSource_branch = N <$> mbranch
822 , _gitHubSource_branch = N <$> mbranch
825 }
823 }
826
824
@@ -917,7 +915,7 @@ parseAbsoluteURI :: Text -> Maybe URI
917parseAbsoluteURI uri = do
915parseAbsoluteURI uri = do
918 parsedUri <- mkURI uri
916 parsedUri <- mkURI uri
919 guard $ isPathAbsolute parsedUri
917 guard $ isPathAbsolute parsedUri
920− pure $ parsedUri
918+ pure parsedUri
921
919
922parseSshShorthand :: Text -> Maybe URI
920parseSshShorthand :: Text -> Maybe URI
923parseSshShorthand uri = do
921parseSshShorthand uri = do