Commit graph

144 commits

Author SHA1 Message Date
Joey Hess
480495beb4 Prevent key names from containing newlines.
There are several places where it's assumed a key can be written on one
line. One is in the format of the .git/annex/unused files. The difficult
one is that filenames derived from keys are fed into git cat-file --batch,
which has a line based input. (And no -z option.)

So, for now it's best to block such keys being created.
2011-12-06 13:03:09 -04:00
Joey Hess
bf460a0a98 reorder repo parameters last
Many functions took the repo as their first parameter. Changing it
consistently to be the last parameter allows doing some useful things with
currying, that reduce boilerplate.

In particular, g <- gitRepo is almost never needed now, instead
use inRepo to run an IO action in the repo, and fromRepo to get
a value from the repo.

This also provides more opportunities to use monadic and applicative
combinators.
2011-11-08 16:27:20 -04:00
Joey Hess
ef3457196a use SHA256 by default
To get old behavior, add a .gitattributes containing: * annex.backend=WORM

I feel that SHA256 is a better default for most people, as long as their
systems are fast enough that checksumming their files isn't a problem.
git-annex should default to preserving the integrity of data as well as git
does. Checksum backends also work better with editing files via
unlock/lock.

I considered just using SHA1, but since that hash is believed to be somewhat
near to being broken, and git-annex deals with large files which would be a
perfect exploit medium, I decided to go to a SHA-2 hash.

SHA512 is annoyingly long when displayed, and git-annex displays it in a
few places (and notably it is shown in ls -l), so I picked the shorter
hash. Considered SHA224 as it's even shorter, but feel it's a bit weird.

I expect git-annex will use SHA-3 at some point in the future, but
probably not soon!

Note that systems without a sha256sum (or sha256) program will fall back to
defaulting to SHA1.
2011-11-04 15:51:01 -04:00
Joey Hess
025ded4a2d tweaks 2011-10-10 17:37:44 -04:00
Joey Hess
6a6ea06cee rename 2011-10-05 16:02:51 -04:00
Joey Hess
cfe21e85e7 rename 2011-10-04 00:59:08 -04:00
Joey Hess
8ef2095fa0 factor out common imports
no code changes
2011-10-03 23:29:48 -04:00
Joey Hess
297bc648b9 make unused check branches and tags too
needs time and space optimisation
2011-09-28 16:43:10 -04:00
Joey Hess
9f6b7935dd go go gadget hlint 2011-09-20 23:24:48 -04:00
Joey Hess
5ff04bf2af tweak 2011-09-15 16:59:52 -04:00
Joey Hess
a64c16bf7d tweak 2011-08-30 13:23:21 -04:00
Joey Hess
dede05171b addurl: --fast can be used to avoid immediately downloading the url.
The tricky part about this is that to generate a key, the file must be
present already. Worked around by adding (back) an URL key type, which
is used for addurl --fast.
2011-08-06 14:57:22 -04:00
Joey Hess
3ffc0bb4f5 foo 2011-08-06 12:50:20 -04:00
Joey Hess
e784757376 hlint tweaks
Did all sources except Remotes/* and Command/*
2011-07-15 03:12:05 -04:00
Joey Hess
9f1577f746 remove unused backend machinery
The only remaining vestiage of backends is different types of keys. These
are still called "backends", mostly to avoid needing to change user interface
and configuration. But everything to do with storing keys in different
backends was gone; instead different types of remotes are used.

In the refactoring, lots of code was moved out of odd corners like
Backend.File, to closer to where it's used, like Command.Drop and
Command.Fsck. Quite a lot of dead code was removed. Several data structures
became simpler, which may result in better runtime efficiency. There should
be no user-visible changes.
2011-07-05 19:57:46 -04:00
Joey Hess
f6063a094e renamed GitRepo to Git
It was always imported qualified as Git anyway
2011-06-30 13:21:39 -04:00
Joey Hess
703c437bd9 rename modules for data types into Types/ directory 2011-06-01 21:56:04 -04:00
Joey Hess
1876db50f2 found a few places I can use newtype
for presumably some speedups
2011-05-21 11:07:08 -04:00
Joey Hess
cd83541872 --backend now overrides any backend configured in .gitattributes files. 2011-05-18 19:34:46 -04:00
Joey Hess
cad0e1c8b7 simplified a bunch of Maybe handling 2011-05-15 03:38:08 -04:00
Joey Hess
bb8e3c5b6d more Control.Monad.State export fix 2011-04-26 19:59:01 -04:00
Joey Hess
43639f69f6 ghc7
* Update Debian build dependencies for ghc 7.
* Debian package is now built with S3 support. Thanks Joachim Breitner for
  making this possible, also thanks Greg Heartsfield for working to improve
  the hS3 library for git-annex.

Also hid a conflicting new symbol from Control.Monad.State
2011-04-21 02:22:40 -04:00
Joey Hess
8bcdf42b99 annex.diskreserve can be given in arbitrary units (ie "0.5 gigabytes") 2011-03-26 14:37:39 -04:00
Joey Hess
6246b807f7 migrate: Support migrating v1 SHA keys to v2 SHA keys with size information that can be used for free space checking. 2011-03-23 17:57:10 -04:00
Joey Hess
04539d1671 improve size change display 2011-03-23 02:42:14 -04:00
Joey Hess
cd1cb52652 tweak 2011-03-23 02:15:26 -04:00
Joey Hess
c43e3b5c78 check key size when available, no matter the backend
Now that SHA and other backends can have size info, fsck should check it
whenever available.
2011-03-23 02:10:59 -04:00
Joey Hess
e227c210ec upgrade groundwork
pulled in old versions of functions for working with keys

Wrote a parser from old key filenames to new keys.
2011-03-16 01:23:20 -04:00
Joey Hess
4594bd51c1 rename file 2011-03-15 22:04:50 -04:00
Joey Hess
9d49fe2c17 first pass at using new keys
It compiles. It sorta works. Several subcommands are FIXME marked and
broken, because things that used to accept separate --backend and --key
params need to be changed to accept just a --key that encodes all the key
info, now that there is metadata in keys.
2011-03-15 21:34:13 -04:00
Joey Hess
a3daac8a8b only enable SHA backends that configure finds support for 2011-03-02 13:47:45 -04:00
Joey Hess
9640417067 avoid warning when symlink in the repo contains a colon but is not a
pointer to annexed content
2011-01-27 16:10:45 -04:00
Joey Hess
e1d213d6e3 make filename available to fsck messages 2011-01-26 20:37:46 -04:00
Joey Hess
616d1d4a20 rename TypeInternals to BackendTypes
Now that it only contains types used by the backends
2011-01-26 00:37:50 -04:00
Joey Hess
6a97b10fcb rework config storage
Moved away from a map of flags to storing config directly in the AnnexState
structure. Got rid of most accessor functions in Annex.

This allowed supporting multiple --exclude flags.
2011-01-26 00:17:38 -04:00
Joey Hess
082b022f9a successfully split Annex and AnnexState out of TypeInternals 2011-01-25 21:49:04 -04:00
Joey Hess
109a719b03 parameterize Backend type
This allows the Backend type to not depend on the Annex type, and
so the Annex type can later be moved out of TypeInternals.
2011-01-25 21:02:34 -04:00
Joey Hess
53170b1a14 fix real underlaying cause, and fix test suite to not skip it 2011-01-09 10:48:04 -04:00
Joey Hess
f4ddb580c8 bugfix: Fix crash caused by a symlink in the repo with link text ending in a "/". (Thanks Henrik for reporting.) 2011-01-09 10:04:16 -04:00
Joey Hess
ca32c7859b The git-annex-backend attribute has been renamed to annex.backend. 2010-11-28 18:58:03 -04:00
Joey Hess
653ad35a9f In .gitattributes, the git-annex-numcopies attribute can be used to control the number of copies to retain of different types of files. 2010-11-28 15:28:20 -04:00
Joey Hess
eeae910242 finished hlinting 2010-11-22 17:51:55 -04:00
Joey Hess
57adb0347b hlint tweaks
Remotes.hs next, and also Backend/* and Command/*
2010-11-22 15:46:57 -04:00
Joey Hess
5c7d1b0279 Fix git annex add ../foo (when ran in a subdir of the repo).
There was no reason for Git.relative to be used here.
2010-11-17 13:55:38 -04:00
Joey Hess
748a7475bb dropunused 2010-11-15 18:04:19 -04:00
Joey Hess
5fa25a812a fsck improvements
* fsck: Check if annex.numcopies is satisfied.
* fsck: Verify the sha1 of files when the SHA1 backend is used.
* fsck: Verify the size of files when the WORM backend is used.
* fsck: Allow specifying individual files to fsk if fscking everything
  is not desired.
* fsck: Fix bug, introduced in 0.04, in detection of unused data.
2010-11-13 14:59:27 -04:00
Joey Hess
070e8530c1 refactoring, no code changes really 2010-11-08 15:15:21 -04:00
Joey Hess
009873e0eb fsck works 2010-11-07 18:22:25 -04:00
Joey Hess
a3519c365f hlinted a few files 2010-11-06 17:07:11 -04:00
Joey Hess
2926cc64fb In .gitattributes, the git-annex-backend attribute can be set to the names of backends to use when adding different types of files. 2010-11-01 19:05:38 -04:00
Joey Hess
899a86f8f9 now only need to add gitattributes lookup 2010-11-01 17:50:37 -04:00
Joey Hess
fd6611f955 Fix crash on unknown symlinks. 2010-10-31 18:04:34 -04:00
Joey Hess
2d893b3331 more Wall cleaning 2010-10-31 14:39:53 -04:00
Joey Hess
583e8118d4 ok, let's just use extensible-exceptions 2010-10-30 17:29:11 -04:00
Joey Hess
23da029b75 Support building with Debian stable's ghc. 2010-10-30 15:10:10 -04:00
Joey Hess
833d4b342e copyright statements 2010-10-27 16:53:54 -04:00
Joey Hess
f4e2dde8a8 fix perl refugee code 2010-10-22 20:47:14 -04:00
Joey Hess
19fde4960d new fromkey subcommand, for registering urls, etc
had to redo Annex monad's flag storage
2010-10-21 16:30:16 -04:00
Joey Hess
f3dcc8489d gratuitous rename 2010-10-18 02:06:27 -04:00
Joey Hess
b471822cfe move supportedBackends list into annex monad
This was necessary so the File backend could import Backend w/o a cycle.

Moved code that checks whether enough backends have a file into File
backend.
2010-10-17 11:47:36 -04:00
Joey Hess
909f619c07 tweaks 2010-10-16 16:20:49 -04:00
Joey Hess
6d13ae10cf git annex describe 2010-10-16 16:15:31 -04:00
Joey Hess
4c3ad80f32 bugfix 2010-10-14 20:05:04 -04:00
Joey Hess
508a3b65ed annex.numcopies works 2010-10-14 17:38:13 -04:00
Joey Hess
aa2f4bd810 bug 2010-10-14 16:13:43 -04:00
Joey Hess
d4ce072452 break depends cycle 2010-10-14 15:58:53 -04:00
Joey Hess
a200761e66 implemented basic --drop 2010-10-14 14:14:19 -04:00
Joey Hess
6f3572e47f more reorg, spiffed up state monad 2010-10-14 03:18:11 -04:00
Joey Hess
0b55bd05de more namespace cleanup 2010-10-14 02:52:17 -04:00
Joey Hess
48643b68b3 convert GitRepo to qualified import 2010-10-14 02:36:41 -04:00
Joey Hess
b160748516 use a state monad
enormous reworking
2010-10-13 21:28:47 -04:00
Joey Hess
99b2029236 key conversion back from file bugfixes 2010-10-13 03:41:12 -04:00
Joey Hess
4b801b265a error handling 2010-10-13 03:20:05 -04:00
Joey Hess
d1071bd1fe autobugfixing!
Converted Key to a real data type and caught all the places where I used
an unconverted filename as a key.

Had to loose some sanity checks around whether something is already
annexed, but I guess I can add those back other ways.
2010-10-13 02:31:24 -04:00
Joey Hess
208bba8d30 got rid of the .git-annex/key.backend files 2010-10-13 00:42:46 -04:00
Joey Hess
490eb66be4 update 2010-10-12 20:20:59 -04:00
Joey Hess
b7858ada03 bugfixes 2010-10-12 20:04:36 -04:00
Joey Hess
a36c39ad0a getting files via http working! 2010-10-12 17:26:34 -04:00
Joey Hess
cad916d926 hookup annexgetfile 2010-10-12 16:52:01 -04:00
Joey Hess
921313bcc7 consistency 2010-10-12 16:40:17 -04:00
Joey Hess
570899ed0c handle newlines on keys 2010-10-12 16:39:10 -04:00
Joey Hess
603e01e96c simplify some function signatures using state 2010-10-12 16:20:41 -04:00
Joey Hess
20acda0423 more state 2010-10-12 16:10:15 -04:00
Joey Hess
2ac47a3a59 thread State thru to backends 2010-10-12 16:06:10 -04:00
Joey Hess
ebc3fbe9ae explicit exports 2010-10-11 17:52:46 -04:00
Joey Hess
af82586adf split up Types 2010-10-11 17:19:55 -04:00
Joey Hess
dc5e8853f3 missed a file 2010-10-10 21:04:25 -04:00
Joey Hess
344f13394f update 2010-10-10 19:53:31 -04:00
Joey Hess
e5514e0cb0 update 2010-10-10 18:05:37 -04:00
Joey Hess
dce9c2e080 convert GitRepo to struct with constructor 2010-10-10 16:06:36 -04:00
Joey Hess
7880dc16fe update 2010-10-10 15:41:35 -04:00
Joey Hess
4631927a5c fix storing files in .git/annex by key 2010-10-10 15:21:17 -04:00
Joey Hess
cc23519235 update 2010-10-10 15:04:18 -04:00
Joey Hess
80ce5f90db update 2010-10-10 13:47:04 -04:00