summaryrefslogtreecommitdiff
path: root/Utility
Commit message (Collapse)AuthorAge
* added ifM and nuked 11 lines of codeGravatar Joey Hess2012-03-14
| | | | no behavior changes
* check hook executabilityGravatar Joey Hess2012-03-14
|
* moveGravatar Joey Hess2012-03-11
|
* perhaps more clear typeGravatar Joey Hess2012-03-10
|
* cleanupGravatar Joey Hess2012-03-09
|
* fix key directory hash calculation codeGravatar Joey Hess2012-03-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix Key directory hash calculation code to behave as it did before version 3.20120227 when a key contains non-ascii. The hash directories for a given Key are based on its md5sum. Prior to ghc 7.4, Keys contained raw, undecoded bytes, so the md5sum was taken of each byte in turn. With the ghc 7.4 filename encoding change, keys contains decoded unicode characters (possibly with surrigates for undecodable bytes). This changes the result of the md5sum, since the md5sum used is pure haskell and supports unicode. And that won't do, as git-annex will start looking in a different hash directory for the content of a key. The surrigates are particularly bad, since that's essentially a ghc implementation detail, so could change again at any time. Also, changing the locale changes how the bytes are decoded, which can also change the md5sum. Symptoms would include things like: * git annex fsck would complain that no copies existed of a file, despite its symlink pointing to the content that was locally present * git annex fix would change the symlink to use the wrong hash directory. Only WORM backend is likely to have been affected, since only it tends to include much filename data (SHA1E could in theory also be affected). I have not tried to support the hash directories used by git-annex versions 3.20120227 to 3.20120308, so things added with those versions with WORM will require manual fixups. Sorry for the inconvenience!
* factor out Utility.FileSystemEncodingGravatar Joey Hess2012-03-09
|
* refactorGravatar Joey Hess2012-03-09
|
* Fix a bug in symlink calculation code, that triggered in rare cases where an ↵Gravatar Joey Hess2012-03-05
| | | | | | | | | | | annexed file is in a subdirectory that nearly matched to the .git/annex/object/xx/yy subdirectories. This is a straight up pure-code stinker. The relative path calculation looked for common subdirectories in the two paths, but failed to stop after the paths diverged. When a later pair of subdirectories were the same, the resulting relative path was wrong. Added regression test for this.
* refactorGravatar Joey Hess2012-02-20
|
* hlintGravatar Joey Hess2012-02-16
|
* work around Network.Browser bug that converts a HEAD to a GET when following ↵Gravatar Joey Hess2012-02-10
| | | | | | | | | | | | | | | | | | | | | | a redirect The code explicitly switches from HEAD to GET for most redirects. Possibly because someone misread a spec (which does require switching from POST to GET for 303 redirects). Or possibly because the spec really is that bad. Upstream bug: https://github.com/haskell/HTTP/issues/24 Since we absolutely don't want to download entire (large) files from the web when checking that they exist with HEAD, I wrote my own redirect follower, based closely on the one used by Network.Browser, but without this misfeature. Note that Network.Browser checks that the redirect url is a http url and fails if not. I don't, because I want to not need to change this code when it gets https support (related: I'm surprised to see it doesn't support https yet..). The check does not seem security significant; it doesn't support file:// urls for example. If a http url is redirected to https, the Network.Browser will actually make a http connection again. This could loop, but only up to 5 times.
* When checking that an url has a key, verify that the Content-Length, if ↵Gravatar Joey Hess2012-02-10
| | | | | | | | available, matches the size of the key. If there's no Content-Length, or the key has no size, this check is not done, but it should happen most of the time, and protect against web content that has changed.
* really fix foreign C functions filename encodingsGravatar Joey Hess2012-02-04
| | | | GHC should probably export withFilePath.
* fix touch and statfs to work on any files in any localeGravatar Joey Hess2012-02-04
| | | | | | | Use withCAString rather than withCString. XXX Actually, this only works in non-unicode locales when presented with unicode characters. Help?
* Merge branch 'master' into ghc7.4Gravatar Joey Hess2012-02-03
|\ | | | | | | | | Conflicts: Utility/Misc.hs
| * IO exception reworkGravatar Joey Hess2012-02-03
| | | | | | | | | | | | ghc 7.4 comaplains about use of System.IO.Error to catch exceptions. Ok, use Control.Exception, with variants specialized to only catch IO exceptions.
* | support all filename encodings with ghc 7.4Gravatar Joey Hess2012-02-03
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Under ghc 7.4, this seems to be able to handle all filename encodings again. Including filename encodings that do not match the LANG setting. I think this will not work with earlier versions of ghc, it uses some ghc internals. Turns out that ghc 7.4 has a special filesystem encoding that it uses when reading/writing filenames (as FilePaths). This encoding is documented to allow "arbitrary undecodable bytes to be round-tripped through it". So, to get FilePaths from eg, git ls-files, set the Handle that is reading from git to use this encoding. Then things basically just work. However, I have not found a way to make Text read using this encoding. Text really does assume unicode. So I had to switch back to using String when reading/writing data to git. Which is a pity, because it's some percent slower, but at least it works. Note that stdout and stderr also have to be set to this encoding, or printing out filenames that contain undecodable bytes causes a crash. IMHO this is a misfeature in ghc, that the user can pass you a filename, which you can readFile, etc, but that default, putStr of filename may cause a crash! Git.CheckAttr gave me special trouble, because the filenames I got back from git, after feeding them in, had further encoding breakage. Rather than try to deal with that, I just zip up the input filenames with the attributes. Which must be returned in the same order queried for this to work. Also of note is an apparent GHC bug I worked around in Git.CheckAttr. It used to forkProcess and feed git from the child process. Unfortunatly, after this forkProcess, accessing the `files` variable from the parent returns []. Not the value that was passed into the function. This screams of a bad bug, that's clobbering a variable, but for now I just avoid forkProcess there to work around it. That forkProcess was itself only added because of a ghc bug, #624389. I've confirmed that the test case for that bug doesn't reproduce it with ghc 7.4. So that's ok, except for the new ghc bug I have not isolated and reported. Why does this simple bit of code magnet the ghc bugs? :) Also, the symlink touching code is currently broken, when used on utf-8 filenames in a non-utf-8 locale, or probably on any filename containing undecodable bytes, and I temporarily commented it out.
* switch to the strict state monadGravatar Joey Hess2012-01-29
| | | | | | | | | | I had not realized what a memory leak the lazy state monad could be, although I have not seen much evidence of actual leaking in git-annex. However, if running git-annex on a great many files, this could matter. The additional Utility.State.changeState adds even more strictness, avoiding a problem I saw in github-backup where repeatedly modifying state built up a huge pile of thunks.
* remove Utility.Conditional and use IfElseGravatar Joey Hess2012-01-24
| | | | | | | This drops the >>! and >>? with the nice low fixity. IfElse does have undocumented >>=>>! and >>=>>? operators, but I deem that too fishy. Anyway, using whenM and unlessM is easier; I sometimes mixed the operators up.
* rename readMaybe to readishGravatar Joey Hess2012-01-23
| | | | a stricter (but also partial) readMaybe is getting added to base
* a few things available elsewhere...Gravatar Joey Hess2012-01-23
|
* treakGravatar Joey Hess2012-01-21
|
* typoGravatar Joey Hess2012-01-20
|
* Add a sanity check for bad StatFS results.Gravatar Joey Hess2012-01-14
| | | | | | | | | | | | | | | git-annex FTBFS on s390, mips, powerpc, sparc. That StatFS code is failing on all of them. At least on s390, the failure appears as: Just (FileSystemStats {fsStatBlockSize = 4096, fsStatBlockCount = 0, fsStatByteCount = 0, fsStatBytesFree = 0, fsStatBytesAvailable = 0, fsStatBytesUsed = 0}) While I don't understand why this is happening, or how to fix it, bandaid over it by checking for obviously bad values and returning Nothing. That disables disk free space checking, but at least git-annex will work. Upstream bug: http://code.google.com/p/xmobar/issues/detail?id=70
* don't use GPG_AGENT_INFO to force batch mode in test suiteGravatar Joey Hess2012-01-09
| | | | | | | | Fails with gpg 2. Instead, use a different environment variable. The clean fix would instead be to add an annex.gpg-options configuration. But, that would be rather a lot of work and it's unlikely it would be useful for much else.
* Fix overbroad gpg --no-tty fix from last release.Gravatar Joey Hess2012-01-07
| | | | | | | Only set --no-tty when GPG_AGENT_INFO is set and batch mode is used. In the test suite, set GPG_AGENT_INFO to /dev/null to avoid the test suite relying on /dev/tty.
* Run gpg with --no-tty. Closes: #654721Gravatar Joey Hess2012-01-05
|
* typoGravatar Joey Hess2012-01-03
|
* after is a better name for observe_Gravatar Joey Hess2012-01-03
|
* no implicit dotfiles in addGravatar Joey Hess2012-01-03
| | | | | | | | | | | | | | | | | | | | | | | | Dotfiles, and files inside dotdirs are not added by "git annex add" unless the dotfile or directory is explicitly listed. So "git annex add ." will add all untracked files in the current directory except for those in dotdirs. One reason for this is that it will make git-annex more usable with vcsh, where you don't want "vcsh big annex add" to check in all the dotfiles that are already versioned in other repositories. (If you're using vcsh for repos that contain non-dotfiles, this won't help, and you'll need to .gitignore such things, but this will cover the common case.) A more general reason why this seems like a good idea is the same reason ls ignores dotfiles, just the unix convention that they are cruft that is kept out of the way most of the time. All the other git-annex commands still do deal with any dotfiles that do get into the annex. This seemed right because if I've gone to the trouble to add a dotfile, I will want "git annex get ." to get it along with everything else.
* factor observe_Gravatar Joey Hess2012-01-03
|
* Added remote.name.annex-web-options configuration setting, which can be used ↵Gravatar Joey Hess2012-01-02
| | | | to provide parameters to whichever of wget or curl git-annex uses (depends on which is available, but most of their important options suitable for use here are the same).
* add a new useful thingGravatar Joey Hess2012-01-02
|
* cleanupGravatar Joey Hess2011-12-23
|
* add escape_var hackGravatar Joey Hess2011-12-23
| | | | Makes it easy to find files with duplicate contents, anyway.. :)
* reorgGravatar Joey Hess2011-12-23
|
* handle C-style escapes in FormatGravatar Joey Hess2011-12-23
| | | | | | | | | | | I was happily able to repurpose some code from Git.Filename to handle this. I remember writing that code... a whole afternoon at a coffee shop, after which I felt I'd struggled with Haskell and git, and sorta lost, in needing to write this nasty peice of code. But was also pleased at the use of a pair of functions and quickcheck that allowed me to get it 100% right. So, turns out I not only got it right, but the code wasn't as special-purpose as I'd feared. Yay!
* better data typeGravatar Joey Hess2011-12-22
|
* Format strings can be specified using the new --find option, to control what ↵Gravatar Joey Hess2011-12-22
| | | | is output by git annex find.
* add a text formatterGravatar Joey Hess2011-12-22
| | | | | | This is built for speed; a format string is parsed once, generating a Format, that can be applied repeatedly to different sets of variables to generate output.
* test encrypted special remoteGravatar Joey Hess2011-12-20
| | | | | This involved adding a test harness to run gpg with a dummy key, and lots of fun.
* split out Utility.Gpg with the generic gpg interface, from CryptoGravatar Joey Hess2011-12-20
|
* updateGravatar Joey Hess2011-12-20
|
* commentGravatar Joey Hess2011-12-20
|
* amusing nameGravatar Joey Hess2011-12-20
| | | | | This is both a partial Prelude that conflicts with the real one, and a way to guard against the Prelude's partial functions.
* simplifyGravatar Joey Hess2011-12-15
|
* moveGravatar Joey Hess2011-12-15
|
* more partial function removalGravatar Joey Hess2011-12-15
| | | | | Left a few Prelude.head's in where it was checked not null and too hard to remove, etc.
* add beginning, endGravatar Joey Hess2011-12-15
| | | | Safe versions of init and last