simplify; no need for separate filter reversal function
This commit is contained in:
parent
476778f364
commit
4fc5c21b3f
1 changed files with 7 additions and 12 deletions
|
@ -193,29 +193,24 @@ like this, at its most simple:
|
||||||
|
|
||||||
data FileInfo = FileInfo
|
data FileInfo = FileInfo
|
||||||
{ originalBranchFile :: FileStatus
|
{ originalBranchFile :: FileStatus
|
||||||
, worktreeFile :: Maybe FileStatus
|
|
||||||
, isContentPresent :: Bool
|
, isContentPresent :: Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
data FileStatus = IsAnnexSymlink | IsAnnexPointer
|
data FileStatus = IsAnnexSymlink | IsAnnexPointer
|
||||||
deriving (Eq)
|
deriving (Eq)
|
||||||
|
|
||||||
applyFilter :: Filter -> FilePath -> FileInfo -> FilterAction
|
filterAction :: Filter -> FilePath -> FileInfo -> FilterAction
|
||||||
applyFilter UnlockFilter f fi
|
filterAction UnlockFilter f fi
|
||||||
| worktreeFile fi == Just IsAnnexSymlink = UnlockFile f
|
| originalBranchFile fi == Just IsAnnexSymlink = UnlockFile f
|
||||||
applyFilter HideMissingFilter f fi
|
filterAction HideMissingFilter f fi
|
||||||
| not (isContentPresent fi) = HideFile f
|
| not (isContentPresent fi) = HideFile f
|
||||||
applyFilter UnlockHideMissingFilter f fi
|
filterAction UnlockHideMissingFilter f fi
|
||||||
| not (isContentPresent fi) = HideFile f
|
| not (isContentPresent fi) = HideFile f
|
||||||
| otherwise = applyFilter UnlockFilter f fi
|
| otherwise = filterAction UnlockFilter f fi
|
||||||
applyFilter _ f _ = UnchangedFile f
|
filterAction _ f _ = UnchangedFile f
|
||||||
|
|
||||||
applyFilterAction :: FilePath -> FilterAction -> Annex Bool
|
applyFilterAction :: FilePath -> FilterAction -> Annex Bool
|
||||||
|
|
||||||
-- Look at the current state of file and get the FilterAction that
|
|
||||||
-- would have led to this state.
|
|
||||||
reverseFilter :: Filter -> FilePath -> FileInfo -> FilterAction
|
|
||||||
|
|
||||||
-- Generate a version of the commit made on the filter branch
|
-- Generate a version of the commit made on the filter branch
|
||||||
-- with the filtering of modified files reversed.
|
-- with the filtering of modified files reversed.
|
||||||
unfilteredCommit :: Filter -> Git.Commit -> Git.Commit
|
unfilteredCommit :: Filter -> Git.Commit -> Git.Commit
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue