From 5a8add5d5510c0766738d50ac7bde490ba3fa821 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 26 Sep 2024 17:21:22 -0400 Subject: [PATCH] remove slightly unsafe use of head If git rev-parse somehow didn't output anything, git-annex would crash here. --- Command/Uninit.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Command/Uninit.hs b/Command/Uninit.hs index 1b2e8395a8..a38ac9a7e6 100644 --- a/Command/Uninit.hs +++ b/Command/Uninit.hs @@ -79,7 +79,7 @@ checkCanUninit recordok = current_branch = ifM (inRepo Git.Ref.headExists) - ( Just . Git.Ref . encodeBS . Prelude.head . lines . decodeBS <$> revhead + ( headMaybe . map (Git.Ref . encodeBS) . lines . decodeBS <$> revhead , return Nothing ) revhead = inRepo $ Git.Command.pipeReadStrict