From c011b21850eaaeddf977027db0c05e97f910b748 Mon Sep 17 00:00:00 2001 From: Vladislav Zavialov Date: Wed, 1 Jan 2025 15:32:48 +0300 Subject: [PATCH] [Chore] Use `proc` instead of `shell` to call `git` Use `proc` to avoid the overhead and security considerations of `shell`. --- src/Xrefcheck/Scan.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Xrefcheck/Scan.hs b/src/Xrefcheck/Scan.hs index 874ff0f1..8f993895 100644 --- a/src/Xrefcheck/Scan.hs +++ b/src/Xrefcheck/Scan.hs @@ -39,7 +39,7 @@ import Data.Map qualified as M import Data.Reflection (Given) import Fmt (Buildable (..), Builder, fmtLn) import System.Directory (doesDirectoryExist, pathIsSymbolicLink) -import System.Process (cwd, readCreateProcess, shell) +import System.Process (cwd, readCreateProcess, proc) import Text.Interpolation.Nyan import Text.Regex.TDFA.Common (CompOption (..), ExecOption (..), Regex) import Text.Regex.TDFA.Text qualified as R @@ -185,9 +185,9 @@ readDirectoryWith mode config scanner root = do RdmBothTrackedAndUtracked -> liftA2 (<>) getTrackedFiles getUntrackedFiles getTrackedFiles = readCreateProcess - (shell "git ls-files -z"){cwd = Just root} "" + (proc "git" ["ls-files", "-z"]){cwd = Just root} "" getUntrackedFiles = readCreateProcess - (shell "git ls-files -z --others --exclude-standard"){cwd = Just root} "" + (proc "git" ["ls-files", "-z", "--others", "--exclude-standard"]){cwd = Just root} "" fileLines :: String -> [String] fileLines (dropWhile (== '\0') -> ls) =