where indentation
This commit is contained in:
parent
0714b0bd03
commit
e8a74e9493
1 changed files with 35 additions and 35 deletions
|
@ -30,12 +30,12 @@ inRepo l = pipeNullSplit $ Params "ls-files --cached -z --" : map File l
|
||||||
{- Scans for files at the specified locations that are not checked into git. -}
|
{- Scans for files at the specified locations that are not checked into git. -}
|
||||||
notInRepo :: Bool -> [FilePath] -> Repo -> IO ([FilePath], IO Bool)
|
notInRepo :: Bool -> [FilePath] -> Repo -> IO ([FilePath], IO Bool)
|
||||||
notInRepo include_ignored l repo = pipeNullSplit params repo
|
notInRepo include_ignored l repo = pipeNullSplit params repo
|
||||||
where
|
where
|
||||||
params = [Params "ls-files --others"] ++ exclude ++
|
params = [Params "ls-files --others"] ++ exclude ++
|
||||||
[Params "-z --"] ++ map File l
|
[Params "-z --"] ++ map File l
|
||||||
exclude
|
exclude
|
||||||
| include_ignored = []
|
| include_ignored = []
|
||||||
| otherwise = [Param "--exclude-standard"]
|
| otherwise = [Param "--exclude-standard"]
|
||||||
|
|
||||||
{- Returns a list of all files that are staged for commit. -}
|
{- Returns a list of all files that are staged for commit. -}
|
||||||
staged :: [FilePath] -> Repo -> IO ([FilePath], IO Bool)
|
staged :: [FilePath] -> Repo -> IO ([FilePath], IO Bool)
|
||||||
|
@ -48,9 +48,9 @@ stagedNotDeleted = staged' [Param "--diff-filter=ACMRT"]
|
||||||
|
|
||||||
staged' :: [CommandParam] -> [FilePath] -> Repo -> IO ([FilePath], IO Bool)
|
staged' :: [CommandParam] -> [FilePath] -> Repo -> IO ([FilePath], IO Bool)
|
||||||
staged' ps l = pipeNullSplit $ prefix ++ ps ++ suffix
|
staged' ps l = pipeNullSplit $ prefix ++ ps ++ suffix
|
||||||
where
|
where
|
||||||
prefix = [Params "diff --cached --name-only -z"]
|
prefix = [Params "diff --cached --name-only -z"]
|
||||||
suffix = Param "--" : map File l
|
suffix = Param "--" : map File l
|
||||||
|
|
||||||
{- Returns a list of the files in the specified locations that are staged
|
{- Returns a list of the files in the specified locations that are staged
|
||||||
- for commit, and whose type has changed. -}
|
- for commit, and whose type has changed. -}
|
||||||
|
@ -70,9 +70,9 @@ typeChanged' ps l repo = do
|
||||||
let top = repoPath repo
|
let top = repoPath repo
|
||||||
cwd <- getCurrentDirectory
|
cwd <- getCurrentDirectory
|
||||||
return (map (\f -> relPathDirToFile cwd $ top </> f) fs, cleanup)
|
return (map (\f -> relPathDirToFile cwd $ top </> f) fs, cleanup)
|
||||||
where
|
where
|
||||||
prefix = [Params "diff --name-only --diff-filter=T -z"]
|
prefix = [Params "diff --name-only --diff-filter=T -z"]
|
||||||
suffix = Param "--" : map File l
|
suffix = Param "--" : map File l
|
||||||
|
|
||||||
{- A item in conflict has two possible values.
|
{- A item in conflict has two possible values.
|
||||||
- Either can be Nothing, when that side deleted the file. -}
|
- Either can be Nothing, when that side deleted the file. -}
|
||||||
|
@ -101,8 +101,8 @@ unmerged :: [FilePath] -> Repo -> IO ([Unmerged], IO Bool)
|
||||||
unmerged l repo = do
|
unmerged l repo = do
|
||||||
(fs, cleanup) <- pipeNullSplit params repo
|
(fs, cleanup) <- pipeNullSplit params repo
|
||||||
return (reduceUnmerged [] $ catMaybes $ map parseUnmerged fs, cleanup)
|
return (reduceUnmerged [] $ catMaybes $ map parseUnmerged fs, cleanup)
|
||||||
where
|
where
|
||||||
params = Params "ls-files --unmerged -z --" : map File l
|
params = Params "ls-files --unmerged -z --" : map File l
|
||||||
|
|
||||||
data InternalUnmerged = InternalUnmerged
|
data InternalUnmerged = InternalUnmerged
|
||||||
{ isus :: Bool
|
{ isus :: Bool
|
||||||
|
@ -124,28 +124,28 @@ parseUnmerged s
|
||||||
return $ InternalUnmerged (stage == 2) file
|
return $ InternalUnmerged (stage == 2) file
|
||||||
(Just blobtype) (Just sha)
|
(Just blobtype) (Just sha)
|
||||||
_ -> Nothing
|
_ -> Nothing
|
||||||
where
|
where
|
||||||
(metadata, file) = separate (== '\t') s
|
(metadata, file) = separate (== '\t') s
|
||||||
|
|
||||||
reduceUnmerged :: [Unmerged] -> [InternalUnmerged] -> [Unmerged]
|
reduceUnmerged :: [Unmerged] -> [InternalUnmerged] -> [Unmerged]
|
||||||
reduceUnmerged c [] = c
|
reduceUnmerged c [] = c
|
||||||
reduceUnmerged c (i:is) = reduceUnmerged (new:c) rest
|
reduceUnmerged c (i:is) = reduceUnmerged (new:c) rest
|
||||||
where
|
where
|
||||||
(rest, sibi) = findsib i is
|
(rest, sibi) = findsib i is
|
||||||
(blobtypeA, blobtypeB, shaA, shaB)
|
(blobtypeA, blobtypeB, shaA, shaB)
|
||||||
| isus i = (iblobtype i, iblobtype sibi, isha i, isha sibi)
|
| isus i = (iblobtype i, iblobtype sibi, isha i, isha sibi)
|
||||||
| otherwise = (iblobtype sibi, iblobtype i, isha sibi, isha i)
|
| otherwise = (iblobtype sibi, iblobtype i, isha sibi, isha i)
|
||||||
new = Unmerged
|
new = Unmerged
|
||||||
{ unmergedFile = ifile i
|
{ unmergedFile = ifile i
|
||||||
, unmergedBlobType = Conflicting blobtypeA blobtypeB
|
, unmergedBlobType = Conflicting blobtypeA blobtypeB
|
||||||
, unmergedSha = Conflicting shaA shaB
|
, unmergedSha = Conflicting shaA shaB
|
||||||
}
|
}
|
||||||
findsib templatei [] = ([], deleted templatei)
|
findsib templatei [] = ([], deleted templatei)
|
||||||
findsib templatei (l:ls)
|
findsib templatei (l:ls)
|
||||||
| ifile l == ifile templatei = (ls, l)
|
| ifile l == ifile templatei = (ls, l)
|
||||||
| otherwise = (l:ls, deleted templatei)
|
| otherwise = (l:ls, deleted templatei)
|
||||||
deleted templatei = templatei
|
deleted templatei = templatei
|
||||||
{ isus = not (isus templatei)
|
{ isus = not (isus templatei)
|
||||||
, iblobtype = Nothing
|
, iblobtype = Nothing
|
||||||
, isha = Nothing
|
, isha = Nothing
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue