Commit graph

3029 commits

Author SHA1 Message Date
Joey Hess
79345ad5fc optimisation
avoids a redundant call to git show-ref
2011-12-12 03:30:47 -04:00
Joey Hess
f9cd3f6ad1 optimisation
avoids a useless diff from git-annex..refs/heads/git-annex
2011-12-12 02:31:07 -04:00
Joey Hess
c7e65bbb12 optimiation
avoids reading the config of a local remote twice in a row
2011-12-12 02:24:37 -04:00
Joey Hess
2332afb4bc cleanup 2011-12-12 02:04:48 -04:00
Joey Hess
acd7a52dfd always find optimal merge
Testing b9ac585454, it didn't find the
optimal union merge, the second sha was the one to use, at least in
the case I tried. Let's just try all shas to see if any can be reused.

I stopped using the expensive nub, so despite the use of sets to
sort/uniq file contents, this is probably as fast or faster than it
was before.
2011-12-12 01:59:29 -04:00
Joey Hess
0cbab5de65 refactor 2011-12-12 00:48:25 -04:00
Joey Hess
b9ac585454 more efficient union merges
Tries to avoid generating a new object when the merged content has the same
lines that were in the old object.

I've noticed some merge commits that only move lines around, like this:

- 1323478057.181191s 1 be23c3ac-0ee5-11e0-b185-3b0f9b5b00c5
  1323204972.062151s 1 87e06c7a-7388-11e0-ba07-03cdf300bd87
++1323478057.181191s 1 be23c3ac-0ee5-11e0-b185-3b0f9b5b00c5

Unsure if this will really save anything in practice, since it only looks
at one of the two old objects, and maybe I didn't pick the best one.
2011-12-11 23:02:25 -04:00
Joey Hess
d3d9c8a9a6 add news item for git-annex 3.20111211 2011-12-11 21:56:17 -04:00
Joey Hess
acb2d5a5a6 releasing version 3.20111211 2011-12-11 21:55:51 -04:00
Joey Hess
29b88ad657 avoid redundant call to updateIndex
commitBranch calls updateIndex
2011-12-11 21:46:21 -04:00
Joey Hess
c4c965d602 detect and recover from branch push/commit race
Dealing with a race without using locking is exceedingly difficult and tricky.
Fully tested, I hope.

There are three places left where the branch can be updated, that are not
covered by the race recovery code. Let's prove they're all immune to the
race:

1. tryFastForwardTo checks to see if a fast-forward can be done,
   and then does git-update-ref on the branch to fast-forward it.

   If a push comes in before the check, then either no fast-forward
   will be done (ok), or the push set the branch to a ref that can
   still be fast-forwarded (also ok)

   If a push comes in after the check, the git-update-ref will
   undo the ref change made by the push. It's as if the push did not come
   in, and the next git-push will see this, and try to re-do it.
   (acceptable)

2. When creating the branch for the very first time, an empty index
   is created, and a commit of it made to the branch. The commit's ref
   is recorded as the current state of the index. If a push came in
   during that, it will be noticed the next time a commit is made to the
   branch, since the branch will have changed. (ok)

3. Creating the branch from an existing remote branch involves making
   the branch, and then getting its ref, and recording that the index
   reflects that ref.

   If a push creates the branch first, git-branch will fail (ok).

   If the branch is created and a racing push is then able to change it
   (highly unlikely!) we're still ok, because it first records the ref into
   the index.lck, and then updating the index. The race can cause the
   index.lck to have the old branch ref, while the index has the newly pushed
   branch merged into it, but that only results in an unnecessary update of
   the index file later on.
2011-12-11 20:41:35 -04:00
Joey Hess
e04852c8af Merge branch 'master' into new-monad-control
Conflicts:
	git-annex.cabal
2011-12-11 16:55:36 -04:00
Joey Hess
81f311103d a new bug report to track a race 2011-12-11 16:41:56 -04:00
Joey Hess
0236bb020b update 2011-12-11 16:19:54 -04:00
Joey Hess
cfbbda99f4 optimize index updating
The last branch ref that the index was updated to is stored in
.git/annex/index.lck, and the index only updated when the current
branch ref differs.

(The .lck file should later be used for locking too.)

Some more optimization is still needed, since there is some redundancy in
calls to git show-ref.
2011-12-11 16:14:59 -04:00
Joey Hess
8680c415de slow, stupid, and safe index updating
Always merge the git-annex branch into .git/annex/index before making a
commit from the index.

This ensures that, when the branch has been changed in any way
(by a push being received, or changes pulled directly into it, or
even by the user checking it out, and committing a change), the index
reflects those changes.

This is much too slow; it needs to be optimised to only update the
index when the branch has really changed, not every time.

Also, there is an unhandled race, when a change is made to the branch
right after the index gets updated. I left it in for now because it's
unlikely and I didn't want to complicate things with additional locking
yet.
2011-12-11 15:05:53 -04:00
Joey Hess
59971c9230 new bug 2011-12-11 14:47:44 -04:00
Joey Hess
0ba4b1de18 move a file location to Locations.hs 2011-12-11 14:14:28 -04:00
Joey Hess
bf6a3b757a close 2011-12-11 01:15:27 -04:00
Joey Hess
583ba80992 better syntax 2011-12-10 20:53:42 -04:00
Joey Hess
f44f715f51 ensure local remote is initialized when copying to it
Needed due to this scenario: Bare repo origin is made, foo is cloned from it;
foo is initalized; a file is added to foo's annex; git annex move --to origin

Since the git-annex branch has not yet been pushed to origin, it doesn't
auto-initialize. When the content is sent to it, it's stored, but
the remote has NoUUID, and so nothing is logged in the location log.
Then the content is removed from the local repo, and git-annex has lost
track of it.

git annex fsck in origin will find the lost content, but let's not let this
happen. Content should only be sent to initalized remotes.

This cannot happen for non-local remotes, since git-annex-shell always
checks that the repo is initialized.
2011-12-10 19:54:20 -04:00
Joey Hess
9ba99a544b update 2011-12-10 18:51:01 -04:00
Joey Hess
10e8028a42 Fix bug in last version in getting contents from bare repositories. 2011-12-10 18:45:55 -04:00
http://schnouki.net/
bfdc9f28fc 2011-12-10 21:40:01 +00:00
http://joey.kitenet.net/
6cf28585b6 Added a comment 2011-12-10 19:43:04 +00:00
Joey Hess
c5267802f3 version dependency on old monad-control
This should let cabal build it with the right version.
2011-12-10 12:56:02 -04:00
Joey Hess
d6fafc463e Merge branch 'master' of ssh://git-annex.branchable.com 2011-12-10 12:33:48 -04:00
Joey Hess
eecaf42485 no need to show, it's a string 2011-12-10 12:30:31 -04:00
http://www.joachim-breitner.de/
e0e9d1cabd Added a comment 2011-12-10 16:28:29 +00:00
Joey Hess
4200b8038a separate operations 2011-12-10 12:21:22 -04:00
Joey Hess
fb8231f3a1 sync: New command that synchronises the local repository and default remote, by running git commit, pull, and push for you. 2011-12-09 20:27:22 -04:00
Joey Hess
4b3c4c0c2b avoid some read 2011-12-09 18:57:09 -04:00
http://joey.kitenet.net/
be67294a1e Added a comment 2011-12-09 22:56:11 +00:00
Joey Hess
28699c95a7 some work on avoiding partial functions
There are still hundreds of places that use partial functions head, tail,
init, and last.
2011-12-09 18:10:41 -04:00
http://www.joachim-breitner.de/
2cd22c1a13 brr, so many typos today. 2011-12-09 21:25:37 +00:00
http://www.joachim-breitner.de/
07c32dd49c typo 2011-12-09 20:57:00 +00:00
http://www.joachim-breitner.de/
d69cf79e20 2011-12-09 20:47:00 +00:00
Joey Hess
95e748cbd4 inverted logic 2011-12-09 13:38:28 -04:00
Joey Hess
252b2e92b0 cleanup 2011-12-09 13:31:51 -04:00
Joey Hess
7b72524ebd Merge remote-tracking branch 'origin/master' 2011-12-09 13:31:23 -04:00
Joey Hess
14e9b87d44 unannex improvements
Added files don't have to be committed before they can be unannexed.

unannex no longer commits existing staged changes

unannex of the last file in a directory now works, before it failed because
git rm deleted the directory out from under it,
2011-12-09 13:07:31 -04:00
Joey Hess
3f5f28b487 factor out a stopUnless
code melt for lunch
2011-12-09 12:23:45 -04:00
https://www.google.com/accounts/o8/id?id=AItOawnXybLxkPMYpP3yw4b_I6IdC3cKTD-xEdU
e664af5d8c 2011-12-09 10:03:20 +00:00
Joey Hess
d64132a43a hslint 2011-12-09 01:57:13 -04:00
https://www.google.com/accounts/o8/id?id=AItOawnXybLxkPMYpP3yw4b_I6IdC3cKTD-xEdU
b3ac4af6b0 2011-12-08 22:50:45 +00:00
https://www.google.com/accounts/o8/id?id=AItOawnXybLxkPMYpP3yw4b_I6IdC3cKTD-xEdU
e0e40964ab 2011-12-08 22:42:29 +00:00
Joey Hess
e3f1568e0f Fix caching of decrypted ciphers, which failed when drop had to check multiple different encrypted special remotes. 2011-12-08 16:01:46 -04:00
http://gebi.myopenid.com/
2568beee07 2011-12-08 14:24:08 +00:00
http://joey.kitenet.net/
2515bb6520 Added a comment 2011-12-07 20:54:51 +00:00
Joey Hess
8047bba5b9 add: If interrupted, add can leave files converted to symlinks but not yet added to git. Running the add again will now clean up this situtation. 2011-12-07 16:53:53 -04:00