securehash matching
Added --securehash option to match files using a secure hash function, and corresponding securehash preferred content expression. This commit was sponsored by Ethan Aubin.
This commit is contained in:
parent
31275754f5
commit
49114cf4ea
7 changed files with 27 additions and 1 deletions
|
@ -117,6 +117,7 @@ preferredContentParser matchstandard matchgroupwanted getgroupmap configmap mu e
|
||||||
, SimpleToken "groupwanted" (call matchgroupwanted)
|
, SimpleToken "groupwanted" (call matchgroupwanted)
|
||||||
, SimpleToken "present" (simply $ limitPresent mu)
|
, SimpleToken "present" (simply $ limitPresent mu)
|
||||||
, SimpleToken "inpreferreddir" (simply $ limitInDir preferreddir)
|
, SimpleToken "inpreferreddir" (simply $ limitInDir preferreddir)
|
||||||
|
, SimpleToken "securehash" (simply limitSecureHash)
|
||||||
, ValueToken "copies" (usev limitCopies)
|
, ValueToken "copies" (usev limitCopies)
|
||||||
, ValueToken "lackingcopies" (usev $ limitLackingCopies False)
|
, ValueToken "lackingcopies" (usev $ limitLackingCopies False)
|
||||||
, ValueToken "approxlackingcopies" (usev $ limitLackingCopies True)
|
, ValueToken "approxlackingcopies" (usev $ limitLackingCopies True)
|
||||||
|
|
|
@ -7,6 +7,8 @@ git-annex (6.20170215) UNRELEASED; urgency=medium
|
||||||
from being added to .git/annex/objects by any method.
|
from being added to .git/annex/objects by any method.
|
||||||
* fsck: Warn about any files whose content is present, that don't
|
* fsck: Warn about any files whose content is present, that don't
|
||||||
use secure hashes, when annex.securehashesonly is set.
|
use secure hashes, when annex.securehashesonly is set.
|
||||||
|
* Added --securehash option to match files using a secure hash function,
|
||||||
|
and corresponding securehash preferred content expression.
|
||||||
* sync, merge: Fail when the current branch has no commits yet, instead
|
* sync, merge: Fail when the current branch has no commits yet, instead
|
||||||
of not merging in anything from remotes and appearing to succeed.
|
of not merging in anything from remotes and appearing to succeed.
|
||||||
* Run ssh with -n whenever input is not being piped into it,
|
* Run ssh with -n whenever input is not being piped into it,
|
||||||
|
|
|
@ -224,6 +224,11 @@ nonWorkTreeMatchingOptions' =
|
||||||
<> hidden
|
<> hidden
|
||||||
<> completeBackends
|
<> completeBackends
|
||||||
)
|
)
|
||||||
|
, globalFlag Limit.addSecureHash
|
||||||
|
( long "securehash"
|
||||||
|
<> help "match files using a cryptographically secure hash"
|
||||||
|
<> hidden
|
||||||
|
)
|
||||||
, globalSetter Limit.addInAllGroup $ strOption
|
, globalSetter Limit.addInAllGroup $ strOption
|
||||||
( long "inallgroup" <> metavar paramGroup
|
( long "inallgroup" <> metavar paramGroup
|
||||||
<> help "match files present in all remotes in a group"
|
<> help "match files present in all remotes in a group"
|
||||||
|
|
9
Limit.hs
9
Limit.hs
|
@ -1,6 +1,6 @@
|
||||||
{- user-specified limits on files to act on
|
{- user-specified limits on files to act on
|
||||||
-
|
-
|
||||||
- Copyright 2011-2016 Joey Hess <id@joeyh.name>
|
- Copyright 2011-2017 Joey Hess <id@joeyh.name>
|
||||||
-
|
-
|
||||||
- Licensed under the GNU GPL version 3 or higher.
|
- Licensed under the GNU GPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
@ -255,6 +255,13 @@ limitInBackend name = Right $ const $ checkKey check
|
||||||
check key = pure $ keyVariety key == variety
|
check key = pure $ keyVariety key == variety
|
||||||
variety = parseKeyVariety name
|
variety = parseKeyVariety name
|
||||||
|
|
||||||
|
{- Adds a limit to skip files not using a secure hash. -}
|
||||||
|
addSecureHash :: Annex ()
|
||||||
|
addSecureHash = addLimit $ Right limitSecureHash
|
||||||
|
|
||||||
|
limitSecureHash :: MatchFiles Annex
|
||||||
|
limitSecureHash _ = checkKey $ pure . cryptographicallySecure . keyVariety
|
||||||
|
|
||||||
{- Adds a limit to skip files that are too large or too small -}
|
{- Adds a limit to skip files that are too large or too small -}
|
||||||
addLargerThan :: String -> Annex ()
|
addLargerThan :: String -> Annex ()
|
||||||
addLargerThan = addLimit . limitSize (>)
|
addLargerThan = addLimit . limitSize (>)
|
||||||
|
|
|
@ -95,6 +95,11 @@ in either of two repositories.
|
||||||
Matches only files whose content is stored using the specified key-value
|
Matches only files whose content is stored using the specified key-value
|
||||||
backend.
|
backend.
|
||||||
|
|
||||||
|
* `--securehash`
|
||||||
|
|
||||||
|
Matches only files whose content is hashed using a cryptographically
|
||||||
|
secure function.
|
||||||
|
|
||||||
* `--inallgroup=groupname`
|
* `--inallgroup=groupname`
|
||||||
|
|
||||||
Matches only files that git-annex believes are present in all repositories
|
Matches only files that git-annex believes are present in all repositories
|
||||||
|
|
|
@ -96,6 +96,11 @@ elsewhere to allow removing it).
|
||||||
Matches only files whose content is stored using the specified key-value
|
Matches only files whose content is stored using the specified key-value
|
||||||
backend.
|
backend.
|
||||||
|
|
||||||
|
* `securehash`
|
||||||
|
|
||||||
|
Matches only files whose content is hashed using a cryptographically
|
||||||
|
secure function.
|
||||||
|
|
||||||
* `inallgroup=groupname`
|
* `inallgroup=groupname`
|
||||||
|
|
||||||
Matches only files that git-annex believes are present in all repositories
|
Matches only files that git-annex believes are present in all repositories
|
||||||
|
|
|
@ -58,6 +58,7 @@ it assumes all files that are currently present are preferred content.
|
||||||
Here are recent changes to preferred content expressions, and the version
|
Here are recent changes to preferred content expressions, and the version
|
||||||
they were added in.
|
they were added in.
|
||||||
|
|
||||||
|
* "securehash" 6.20170228
|
||||||
* "nothing" 6.201600202
|
* "nothing" 6.201600202
|
||||||
* "anything" 5.20150616
|
* "anything" 5.20150616
|
||||||
* "standard" 5.20140314
|
* "standard" 5.20140314
|
||||||
|
|
Loading…
Add table
Reference in a new issue