summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-06-23 09:56:04 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-06-23 09:56:04 -0400
commit23e765b67c38a9f02b3b5152e7e123819bb696de (patch)
tree0e18d06b500e48f84cc0a33556160ef2ea4f442d
parent9672496a9357c84a4436ead109ba2dc7bc010e8c (diff)
update re git-annex branch direct modification
-rw-r--r--Branch.hs8
-rw-r--r--Locations.hs5
-rw-r--r--doc/internals.mdwn11
3 files changed, 21 insertions, 3 deletions
diff --git a/Branch.hs b/Branch.hs
index a43ee227b..00f406135 100644
--- a/Branch.hs
+++ b/Branch.hs
@@ -164,6 +164,8 @@ updateRef ref
| ref == fullname = return Nothing
| otherwise = do
g <- Annex.gitRepo
+ -- checking with log to see if there have been changes
+ -- is less expensive than always merging
diffs <- liftIO $ Git.pipeRead g [
Param "log",
Param (name++".."++ref),
@@ -176,6 +178,12 @@ updateRef ref
-- By passing only one ref, it is actually
-- merged into the index, preserving any
-- changes that may already be staged.
+ --
+ -- However, any changes in the git-annex
+ -- branch that are *not* reflected in the
+ -- index will be removed. So, documentation
+ -- advises users not to directly modify the
+ -- branch.
liftIO $ GitUnionMerge.merge g [ref]
return $ Just ref
diff --git a/Locations.hs b/Locations.hs
index df4957f3e..f93b0cc50 100644
--- a/Locations.hs
+++ b/Locations.hs
@@ -105,6 +105,11 @@ gitAnnexBadLocation r key = gitAnnexBadDir r </> keyFile key
gitAnnexUnusedLog :: FilePath -> Git.Repo -> FilePath
gitAnnexUnusedLog prefix r = gitAnnexDir r </> (prefix ++ "unused")
+{- .git/annex/journal/ is used to journal changes made to the git-annex
+ - branch -}
+gitAnnexJournalDir :: Git.Repo -> FilePath
+gitAnnexJournalDir r = addTrailingPathSeparator $ gitAnnexDir r </> "journal"
+
{- Checks a symlink target to see if it appears to point to annexed content. -}
isLinkToAnnex :: FilePath -> Bool
isLinkToAnnex s = ("/.git/" ++ objectDir) `isInfixOf` s
diff --git a/doc/internals.mdwn b/doc/internals.mdwn
index 419096744..aaa125599 100644
--- a/doc/internals.mdwn
+++ b/doc/internals.mdwn
@@ -21,9 +21,14 @@ deleting or changing the file contents.
This branch is managed by git-annex, with the contents listed below.
-Note that it assumes only it will modify the branch. If you go in and make
-changes, be sure to remove `.git/index.git-annex` before running git-annex,
-otherwise it will probably revert your changes in its next commit to the branch.
+Note that git-annex assumes only it will modify this branch. If you go in
+and make changes directly, it will probably revert your changes in its next
+commit to the branch.
+
+The best way to make changes to the git-annex branch is instead
+to create a branch of it, with a name like "my/git-annex", and then
+use "git annex merge" to automerge your branch into the main git-annex
+branch.
### `uuid.log`