aboutsummaryrefslogtreecommitdiff
path: root/Command/Reinject.hs
Commit message (Collapse)AuthorAge
* annex.securehashesonlyGravatar Joey Hess2017-02-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cryptographically secure hashes can be forced to be used in a repository, by setting annex.securehashesonly. This does not prevent the git repository from containing files with insecure hashes, but it does prevent the content of such files from being pulled into .git/annex/objects from another repository. We want to make sure that at no point does git-annex accept content into .git/annex/objects that is hashed with an insecure key. Here's how it was done: * .git/annex/objects/xx/yy/KEY/ is kept frozen, so nothing can be written to it normally * So every place that writes content must call, thawContent or modifyContent. We can audit for these, and be sure we've considered all cases. * The main functions are moveAnnex, and linkToAnnex; these were made to check annex.securehashesonly, and are the main security boundary for annex.securehashesonly. * Most other calls to modifyContent deal with other files in the KEY directory (inode cache etc). The other ones that mess with the content are: - Annex.Direct.toDirectGen, in which content already in the annex directory is moved to the direct mode file, so not relevant. - fix and lock, which don't add new content - Command.ReKey.linkKey, which manually unlocks it to make a copy. * All other calls to thawContent appear safe. Made moveAnnex return a Bool, so checked all callsites and made them deal with a failure in appropriate ways. linkToAnnex simply returns LinkAnnexFailed; all callsites already deal with it failing in appropriate ways. This commit was sponsored by Riku Voipio.
* import --reinject-duplicatesGravatar Joey Hess2017-02-09
| | | | | | | | | This is the same as running git annex reinject --known, followed by git-annex import. The advantage to having it in one command is that it only has to hash each file once; the two commands have to hash the imported files a second time. This commit was sponsored by Shane-o on Patreon.
* avoid too-long command synopsisGravatar Joey Hess2016-11-30
| | | | It was making git-annex usage output columns far too wide
* Avoid backtraces on expected failures when built with ghc 8; only use ↵Gravatar Joey Hess2016-11-15
| | | | | | | | | | | | | backtraces for unexpected errors. ghc 8 added backtraces on uncaught errors. This is great, but git-annex was using error in many places for a error message targeted at the user, in some known problem case. A backtrace only confuses such a message, so omit it. Notably, commands like git annex drop that failed due to eg, numcopies, used to use error, so had a backtrace. This commit was sponsored by Ethan Aubin.
* reinject --known: Avoid second, unncessary checksum of file.Gravatar Joey Hess2016-11-07
|
* reinject: Added new mode which can reinject known files into the annex.Gravatar Joey Hess2016-04-22
| | | | For example: git-annex reinject --known /mnt/backup/*
* reinject: When src file's content cannot be verified, leave it alone, ↵Gravatar Joey Hess2016-04-20
| | | | instead of deleting it.
* remove 163 lines of code without changing anything except importsGravatar Joey Hess2016-01-20
|
* other 80% of avoding verification when hard linking to objects in shared repoGravatar Joey Hess2015-10-02
| | | | | | | | | | | | | | | | | | | | In c3b38fb2a075b4250e867ebd910324c65712c747, it actually only handled uploading objects to a shared repository. To avoid verification when downloading objects from a shared repository, was a lot harder. On the plus side, if the process of downloading a file from a remote is able to verify its content on the side, the remote can indicate this now, and avoid the extra post-download verification. As of yet, I don't have any remotes (except Git) using this ability. Some more work would be needed to support it in special remotes. It would make sense for tahoe to implicitly verify things downloaded from it; as long as you trust your tahoe server (which typically runs locally), there's cryptographic integrity. OTOH, despite bup being based on shas, a bup repo under an attacker's control could have the git ref used for an object changed, and so a bup repo shouldn't implicitly verify. Indeed, tahoe seems unique in being trustworthy enough to implicitly verify.
* Do verification of checksums of annex objects downloaded from remotes.Gravatar Joey Hess2015-10-01
| | | | | | | | | | | | | | | | * When annex objects are received into git repositories, their checksums are verified then too. * To get the old, faster, behavior of not verifying checksums, set annex.verify=false, or remote.<name>.annex-verify=false. * setkey, rekey: These commands also now verify that the provided file matches the key, unless annex.verify=false. * reinject: Already verified content; this can now be disabled by setting annex.verify=false. recvkey and reinject already did verification, so removed now duplicate code from them. fsck still does its own verification, which is ok since it does not use getViaTmp, so verification doesn't happen twice when using fsck --from.
* convert all commands to work with optparse-applicativeGravatar Joey Hess2015-07-08
| | | | Still no options though.
* started converting to use optparse-applicativeGravatar Joey Hess2015-07-08
| | | | | | | | | | | | This is a work in progress. It compiles and is able to do basic command dispatch, including git autocorrection, while using optparse-applicative for the core commandline parsing. * Many commands are temporarily disabled before conversion. * Options are not wired in yet. * cmdnorepo actions don't work yet. Also, removed the [Command] list, which was only used in one place.
* import: Fix failure of cross-device import on Windows.Gravatar Joey Hess2015-07-07
| | | | | As well as import, 2 other places ran "mv" manually, so changed them to use moveFile as well.
* update my email address and homepage urlGravatar Joey Hess2015-01-21
|
* doh't use "def" for command definitions, it conflicts with Data.Default.defGravatar Joey Hess2014-10-14
|
* replace (Key, Backend) with KeyGravatar Joey Hess2014-04-17
| | | | | | | | | | Only fsck and reinject and the test suite used the Backend, and they can look it up as needed from the Key. This simplifies the code and also speeds it up. There is a small behavior change here. Before, all commands would warn when acting on an annexed file with an unknown backend. Now, only fsck and reinject show that warning.
* fix inversion of control in CommandSeek (no behavior changes)Gravatar Joey Hess2014-01-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've been disliking how the command seek actions were written for some time, with their inversion of control and ugly workarounds. The last straw to fix it was sync --content, which didn't fit the Annex [CommandStart] interface well at all. I have not yet made it take advantage of the changed interface though. The crucial change, and probably why I didn't do it this way from the beginning, is to make each CommandStart action be run with exceptions caught, and if it fails, increment a failure counter in annex state. So I finally remove the very first code I wrote for git-annex, which was before I had exception handling in the Annex monad, and so ran outside that monad, passing state explicitly as it ran each CommandStart action. This was a real slog from 1 to 5 am. Test suite passes. Memory usage is lower than before, sometimes by a couple of megabytes, and remains constant, even when running in a large repo, and even when repeatedly failing and incrementing the error counter. So no accidental laziness space leaks. Wall clock speed is identical, even in large repos. This commit was sponsored by an anonymous bitcoiner.
* reinject: Allow to be used in direct mode.Gravatar Joey Hess2013-11-26
|
* hlintGravatar Joey Hess2013-09-25
| | | | test suite still passes
* add section metadata to all commandsGravatar Joey Hess2013-03-24
| | | | Not yet used .. mindless train work.
* block all commands that don't work in direct modeGravatar Joey Hess2012-12-29
| | | | | I left status working in direct mode, although it doesn't show correct stats for known annex keys.
* where indentationGravatar Joey Hess2012-11-12
|
* reinject: When the provided file doesn't match, leave it where it is, rather ↵Gravatar Joey Hess2012-09-16
| | | | than moving to .git/annex/bad/
* hlintGravatar Joey Hess2012-02-16
|
* type alias cleanupGravatar Joey Hess2011-12-31
|
* add back messageGravatar Joey Hess2011-12-16
|
* reinject: Add a sanity check for using an annexed file as the source file.Gravatar Joey Hess2011-12-12
|
* better limiting of start actions to only run whenAnnexedGravatar Joey Hess2011-11-10
| | | | | Mostly only refactoring, but this does remove one redundant stat of the symlink by copy.
* better usageGravatar Joey Hess2011-11-07
|
* cleanupGravatar Joey Hess2011-10-31
|
* better command nameGravatar Joey Hess2011-10-31