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.
This commit is contained in:
Joey Hess 2011-06-21 19:52:40 -04:00
parent 5e0adb2637
commit 7a693394f4
3 changed files with 70 additions and 43 deletions

View file

@ -44,5 +44,6 @@ main = do
g <- Git.configRead =<< Git.repoFromCwd
Git.useIndex (tmpIndex g)
setup g
GitUnionMerge.merge g aref bref newref False
GitUnionMerge.merge g [aref, bref]
GitUnionMerge.commit g "union merge" newref [aref, bref]
cleanup g