improve
This commit is contained in:
parent
3f8f534646
commit
cd84944bc5
1 changed files with 19 additions and 6 deletions
|
@ -185,7 +185,11 @@ like this, at its most simple:
|
||||||
|
|
||||||
setFilter :: Filter -> Annex ()
|
setFilter :: Filter -> Annex ()
|
||||||
|
|
||||||
data FilterAction = UnchangedFile | UnlockFile | HideFile | RenameFile FilePath FilePath
|
data FilterAction
|
||||||
|
= UnchangedFile FilePath
|
||||||
|
| UnlockFile FilePath
|
||||||
|
| HideFile FilePath
|
||||||
|
| RenameFile FilePath FilePath
|
||||||
|
|
||||||
data FileInfo = FileInfo
|
data FileInfo = FileInfo
|
||||||
{ originalBranchFile :: FileStatus
|
{ originalBranchFile :: FileStatus
|
||||||
|
@ -194,15 +198,24 @@ like this, at its most simple:
|
||||||
}
|
}
|
||||||
|
|
||||||
data FileStatus = IsAnnexSymlink | IsAnnexPointer
|
data FileStatus = IsAnnexSymlink | IsAnnexPointer
|
||||||
|
deriving (Eq)
|
||||||
|
|
||||||
applyFilter :: Filter -> FilePath -> FileInfo -> FilterAction
|
applyFilter :: Filter -> FilePath -> FileInfo -> FilterAction
|
||||||
|
applyFilter UnlockFilter f fi
|
||||||
|
| worktreeFile fi == Just IsAnnexSymlink = UnlockFile f
|
||||||
|
applyFilter HideMissingFilter f fi
|
||||||
|
| not (isContentPresent fi) = HideFile f
|
||||||
|
applyFilter UnlockHideMissingFilter f fi
|
||||||
|
| not (isContentPresent fi) = HideFile f
|
||||||
|
| otherwise = applyFilter UnlockFilter f fi
|
||||||
|
applyFilter _ f _ = UnchangedFile f
|
||||||
|
|
||||||
|
applyFilterAction :: FilePath -> FilterAction -> Annex Bool
|
||||||
|
|
||||||
-- Look at the current state of file and get the FilterAction that
|
-- Look at the current state of file and get the FilterAction that
|
||||||
-- would have led to this state.
|
-- would have led to this state.
|
||||||
reverseFilter :: Filter -> FilePath -> FileInfo -> FilterAction
|
reverseFilter :: Filter -> FilePath -> FileInfo -> FilterAction
|
||||||
|
|
||||||
applyFilterAction :: FilePath -> FilterAction -> Annex Bool
|
-- Generate a version of the commit made on the filter branch
|
||||||
|
-- with the filtering of modified files reversed.
|
||||||
-- Generate a version of the original commit with the filtering of
|
unfilteredCommit :: Filter -> Git.Commit -> Git.Commit
|
||||||
-- modified files reversed.
|
|
||||||
reverseFilterActions :: [(FilePath, FilterAction)] -> Git.Commit -> Git.Commit
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue