summaryrefslogtreecommitdiff
path: root/Utility
Commit message (Collapse)AuthorAge
* 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
* fix typesGravatar Joey Hess2011-12-15
|
* cleanupGravatar Joey Hess2011-12-12
|
* avoid some readGravatar Joey Hess2011-12-09
|
* some work on avoiding partial functionsGravatar Joey Hess2011-12-09
| | | | | There are still hundreds of places that use partial functions head, tail, init, and last.
* hslintGravatar Joey Hess2011-12-09
|
* refactorGravatar Joey Hess2011-12-03
|
* factor out untilTrueGravatar Joey Hess2011-12-02
|
* support .git/annex on a different disk than the rest of the repoGravatar Joey Hess2011-11-28
| | | | | | | | | | | | | | | | | | The only fully supported thing is to have the main repository on one disk, and .git/annex on another. Only commands that move data in/out of the annex will need to copy it across devices. There is only partial support for putting arbitrary subdirectories of .git/annex on different devices. For one thing, but this can require more copies to be done. For example, when .git/annex/tmp is on one device, and .git/annex/journal on another, every journal write involves a call to mv(1). Also, there are a few places that make hard links between various subdirectories of .git/annex with createLink, that are not handled. In the common case without cross-device, the new moveFile is actually faster than renameFile, avoiding an unncessary stat to check that a file (not a directory) is being moved. Of course if a cross-device move is needed, it is as slow as mv(1) of the data.
* Remove haskell98 to build with ghc 7.2.2, also built with ghc 7.0.4Gravatar Mark Wright2011-11-26
| | | | Signed-off-by: Joey Hess <joey@kitenet.net>
* Avoid excessive escaping for rsync special remotes that are not accessed ↵Gravatar Joey Hess2011-11-18
| | | | | | | | | over ssh. This is actually tricky, 45bbf210a1210172c7c7b87879ed74f7c8ccbdba added the escaping because it's needed for rsync that does go over ssh. So I had to detect whether the remote's rsync url will use ssh or not, and vary the escaping.
* factored out some useful error catching methodsGravatar Joey Hess2011-11-10
|