summaryrefslogtreecommitdiff
path: root/Command/Unused.hs
Commit message (Collapse)AuthorAge
* 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.
* avoid trying to find minimum element of empty mapGravatar Joey Hess2014-01-18
|
* dropunused, addunused: Allow "all" instead of a range to act on all unused data.Gravatar Joey Hess2013-11-18
|
* update for DiffTree type changeGravatar Joey Hess2013-10-17
| | | | Experimentally, using the raw TopFilePath was right here.
* queue downloads of keys that fsck finds with bad contentGravatar Joey Hess2013-10-10
|
* remove *>=> and >=*> ; use <$$> insteadGravatar Joey Hess2013-09-27
| | | | | | | | I forgot I had <$$> hidden away in Utility.Applicative. It allows doing the same kind of currying as does >=*> and I found using it made the code more readable for me. (*>=> was not used)
* Unused: bugfixGravatar guilhem2013-08-26
| | | | Detect staged files that are not in the working tree.
* fix reversion in unusedGravatar Joey Hess2013-08-26
| | | | | | The reversion was that, if a file was git rm'd, but still in branches, it would not be seen as used. Looking at both the added and the removed (or changed) files from the diff-index is a cheap way to fix that.
* whitespaceGravatar Joey Hess2013-08-25
|
* unnecessary do blockGravatar Joey Hess2013-08-25
|
* Speed up the 'unused' command.Gravatar guilhem2013-08-25
| | | | | | | | | | | Instead of populating the second-level Bloom filter with every key referenced in every Git reference, consider only those which differ from what's referenced in the index. Incidentaly, unlike with its old behavior, staged modifications/deletion/... will now be detected by 'unused'. Credits to joeyh for the algorithm. :-)
* unused: Pay attention to symlinks that are not yet staged in the index.Gravatar Joey Hess2013-08-22
|
* unused: No longer shows as unused tmp files that are actively being transferred.Gravatar Joey Hess2013-07-25
|
* dropunused, addunused: Complain when asked to operate on a number that does ↵Gravatar Joey Hess2013-07-08
| | | | not correspond to any unused key.
* --unused: New switch that makes git-annex operate on all data found by the ↵Gravatar Joey Hess2013-07-03
| | | | last run of git annex unused. Supported by fsck, get, move, copy.
* add section metadata to all commandsGravatar Joey Hess2013-03-24
| | | | Not yet used .. mindless train work.
* status: Can now be run with a directory path to show only the status of that ↵Gravatar Joey Hess2013-03-11
| | | | directory, rather than the whole annex.
* two types of byNameGravatar Joey Hess2013-03-05
| | | | | | | | Clean up from 5123a1a83aa3b954fe67629508bab5ccea0e4148. In some cases, looking up a remote by name even though it has no UUID is desirable. This includes git annex sync, which can operate on remotes without an annex, and XMPP pairing, which runs addRemote (with calls byName) before the UUID of the XMPP remote has been configured in git.
* type based git config handling for remotesGravatar Joey Hess2013-01-01
| | | | | Still a couple of places that use git config ad-hoc, but this is most of it done.
* type based git config handlingGravatar Joey Hess2012-12-29
| | | | | | | | | | | Now there's a Config type, that's extracted from the git config at startup. Note that laziness means that individual config values are only looked up and parsed on demand, and so we get implicit memoization for all of them. So this is not only prettier and more type safe, it optimises several places that didn't have explicit memoization before. As well as getting rid of the ugly explicit memoization code. Not yet done for annex.<remote>.* configuration settings.
* where indentationGravatar Joey Hess2012-11-12
|
* fix last zombies in the assistantGravatar Joey Hess2012-10-04
| | | | | Made Git.LsFiles return cleanup actions, and everything waits on processes now, except of course for Seek.
* make a pipeReadStrict, that properly waits on the processGravatar Joey Hess2012-10-04
| | | | | | Nearly everything that's reading from git is operating on a small amount of output and has been switched to use that. Only pipeNullSplit stuff continues using the lazy version that yields zombies.
* fix breakage caught by test suiteGravatar Joey Hess2012-09-21
| | | | | Can't use show-ref --tags --branches, as that omits remote branches. Instead, filter out the synced refs directly.
* better name for fallback sync refsGravatar Joey Hess2012-09-16
| | | | | | | | | | | Don't expose these as branches in refs/heads/. Instead hide them away in refs/synced/ where only show-ref will find them. Make unused only look at branches and tags, not these other things, so it won't care if some stale sync ref used to use a file. This means they don't need to be deleted, which could have led to an incoming sync being missed.
* add routes to pause/start/cancel transfersGravatar Joey Hess2012-08-08
| | | | | | | | | | | | | | | | This commit includes a paydown on technical debt incurred two years ago, when I didn't know that it was bad to make custom Read and Show instances for types. As the routes need Read and Show for Transfer, which includes a Key, and deriving my own Read instance of key was not practical, I had to finally clean that up. So the compact Key read and show functions are now file2key and key2file, and Read and Show are now derived instances. Changed all code that used the old instances, compiler checked. (There were a few places, particularly in Command.Unused, and the test suite where the Show instance continue to be used for legitimate comparisons; ie show key_x == show key_y (though really in a bloom filter))
* unused, status: Avoid crashing when ran in bare repo.Gravatar Joey Hess2012-08-05
|
* unused: Fix crash when file names contain invalid utf8.Gravatar Joey Hess2012-06-20
| | | | | | Was decoding the git-cat-file of the symlink target as utf8, but that can't do, unix filenames are from the 70's and need this shiny disco fileSystemEncoding.
* fishy commitGravatar Joey Hess2012-06-14
|
* Clean up handling of git directory and git worktree.Gravatar Joey Hess2012-05-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Baked into the code was an assumption that a repository's git directory could be determined by adding ".git" to its work tree (or nothing for bare repos). That fails when core.worktree, or GIT_DIR and GIT_WORK_TREE are used to separate the two. This was attacked at the type level, by storing the gitdir and worktree separately, so Nothing for the worktree means a bare repo. A complication arose because we don't learn where a repository is bare until its configuration is read. So another Location type handles repositories that have not had their config read yet. I am not entirely happy with this being a Location type, rather than representing them entirely separate from the Git type. The new code is not worse than the old, but better types could enforce more safety. Added support for core.worktree. Overriding it with -c isn't supported because it's not really clear what to do if a git repo's config is read, is not bare, and is then overridden to bare. What is the right git directory in this case? I will worry about this if/when someone has a use case for overriding core.worktree with -c. (See Git.Config.updateLocation) Also removed and renamed some functions like gitDir and workTree that misused git's terminology. One minor regression is known: git annex add in a bare repository does not print a nice error message, but runs git ls-files in a way that fails earlier with a less nice error message. This is because before --work-tree was always passed to git commands, even in a bare repo, while now it's not.
* Fix use of several config settingsGravatar Joey Hess2012-05-05
| | | | | | | annex.ssh-options, annex.rsync-options, annex.bup-split-options. And adjust types to avoid the bugs that broke several config settings recently. Now "annex." prefixing is enforced at the type level.
* addunused: New command, the opposite of dropunused, it relinks unused ↵Gravatar Joey Hess2012-05-02
| | | | content into the git repository.
* noopGravatar Joey Hess2012-04-21
|
* use new getConfigGravatar Joey Hess2012-03-22
|
* added ifM and nuked 11 lines of codeGravatar Joey Hess2012-03-14
| | | | no behavior changes
* finish bloom filtersGravatar Joey Hess2012-03-12
| | | | | | | | Add tuning, docs, etc. Not sure if status is the right place to remote size.. perhaps unused should report the size and also warn if it sees more keys than the bloom filter allows?
* added second stage bloom filterGravatar Joey Hess2012-03-12
|
* fixed bloom filter creation space leakGravatar Joey Hess2012-03-12
| | | | it works!
* try at using bloom filtersGravatar Joey Hess2012-03-12
| | | | leaks memory
* prettifyGravatar Joey Hess2012-03-11
|
* avoid needing to keep list of present keysGravatar Joey Hess2012-03-11
| | | | | | Stale and bad files are rare, so it's more efficient to use inAnnex to see if they can be deleted, rather than keeping the list of all present keys around for them.
* status: Fixed to run in nearly constant space.Gravatar Joey Hess2012-03-11
| | | | | | | | Before, it leaked space due to caching lists of keys. Now all necessary data about keys is calculated as they stream in. The "nearly constant" is due to getKeysPresent, which builds up a lot of [] thunks as it traverses .git/annex/objects/. Will deal with it later.
* unused: Reduce memory usage significantly.Gravatar Joey Hess2012-03-11
| | | | | | | | | | | | | | | | | Much of the memory bloat turned out to be due to getKeysReferenced containing a mapM, which is strict and buffered the whole list rather than streaming it. The other half of the bloat was due to building a temporary Set in order to call S.difference. While that is more cpu efficient, I switched to successive S.delete, since with it, I can run a whole git annex unused in less than 8 mb of memory. The whole Set of keys with content available is still stored in memory, so running unused in a repo with a whole lot of file content will still use more memory. In a repo containing 6000 files, it needed 40 mb. Note that the status command still uses the bloatful getKeysReferenced.
* "here" can be used to refer to the current repository, which can read better ↵Gravatar Joey Hess2012-03-01
| | | | than the old "." (which still works too).
* hlintGravatar Joey Hess2012-02-16
|
* 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.
* attempt at a quick, utf-8 only fix to the ghc 7.4 problemGravatar Joey Hess2012-02-01
| | | | | If you have only utf-8 filenames, and need to build git-annex with ghc 7.4, this will work. But, it will crash on non-utf-8 filenames.
* tweakGravatar Joey Hess2012-01-06
|
* look up --to and --from remote names only onceGravatar Joey Hess2012-01-06
| | | | This will speed up commands like move and drop.
* more command-specific optionsGravatar Joey Hess2012-01-06
| | | | | | | | | | | | | | | | | | | | | Made --from and --to command-specific options. Added generic storage for values of command-specific options, which allows removing some of the special case fields in AnnexState. (Also added generic storage for command-specific flags, although there are not yet any.) Note that this storage uses a Map, so repeatedly looking up the same value is slightly more expensive than looking up an AnnexState field. But, the value can be looked up once in the seek stage, transformed as necessary, and passed in a closure to the start stage, and this avoids that overhead. Still, I'm hesitant to use this for things like force or fast flags. It's probably best to reserve it for flags that are only used by a few commands, or options like --from and --to that it's important only be allowed to be used with commands that implement them, to avoid user confusion.