Commit graph

10 commits

Author SHA1 Message Date
Joey Hess
36109a286e squelched git-cat-file's error message when file DNE
This seemed much too hard to do. I just wanted to close stderr
when running it.
2011-06-22 19:48:04 -04:00
Joey Hess
2035b22a01 better branch display 2011-06-22 17:47:06 -04:00
Joey Hess
4c4ebf2d75 store trust.log and remote.log in the git-annex branch
.. and I think that's everything that will use the branch
2011-06-22 17:08:51 -04:00
Joey Hess
8166facaef Branch handling improvements
Support creating the branch.

Unified branch state into a single data type.

Only commit changes when the index has been changed.
2011-06-22 15:58:30 -04:00
Joey Hess
78a325b093 add a small cache of the most recently accessed item from the git-annex branch
This will speed up typical cases like git-annex get, which currently
has to read the location log once, then read it a second time in order to
add a line to it. Since these reads now involve more than just reading
in a file, it seemed good to add a cache layer.

Only the most recent thing needs to be cached, because git-annex has
good locality; it operates on one file at a time, and only cares
about one item from the branch per file.
2011-06-22 14:18:49 -04:00
Joey Hess
7a693394f4 allow for union merges between a tree and the content in the index
This is needed for robust handling of the git-annex branch. Since changes
are staged to its index as git-annex runs, and committed at the end,
it's possible that git-annex is interrupted, and leaves a dirty index.

When it next runs, it needs to be able to merge the git-annex branch
as necessary, without losing the existing changes in the index.

Note that this assumes that the git-annex branch is only modified by
git-annex. Any changes to it will be lost when git-annex updates the
branch. I don't see a good, inexpensive way to find changes in
the git-annex branch that arn't in the index, and union merging the
git-annex branch into the index every time would likewise be expensive.
2011-06-21 20:12:53 -04:00
Joey Hess
5e0adb2637 fixes
make commit commit to the right branch

when getting content from the branch, update first
2011-06-21 19:11:55 -04:00
Joey Hess
40ec8a9726 Branch module complete
Refactored some code that it needs into GitRepo.
2011-06-21 17:52:39 -04:00
Joey Hess
7e7428f173 refactor 2011-06-21 16:08:09 -04:00
Joey Hess
c03af0ed0c code to update a git-annex branch
There is no suitable git hook to run code when pulling changes that
might need to be merged into the git-annex branch. The post-merge hook
is only run when changes are merged into HEAD, and it's possible,
and indeed likely that many pulls will only have changes in git-annex,
but not in HEAD, and not trigger it.

So, git-annex will have to take care to update the branch before reading
from it, to make sure it has merged in current info from remotes. Happily,
this can be done quite inexpensively, just a git-show-ref to list
branches, and a minimalized git-log to see if there are unmerged changes
on the branches. To further speed up, it will be done only once per
git-annex run, max.
2011-06-21 14:33:59 -04:00