aboutsummaryrefslogtreecommitdiff
path: root/doc/direct_mode.mdwn
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-11-05 14:24:28 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-11-05 14:24:28 -0400
commit83c6fbde28cb25f377bd37d0eedde52c87874052 (patch)
tree5227c2e22bcf95dd6ca97833772ae1e8df042930 /doc/direct_mode.mdwn
parente96c613c026c2d0bd6cce7210b058533d3ce972c (diff)
support direct mode repositories with core.bare=true (not yet default)
Direct mode repositories can now have core.bare=true set, to prevent accidentally running git commands that try to operate on the work tree, and so do the wrong thing. This is not yet the default, and it causes known problems for git-annex sync due to receive.denyCurrentBranch not working in bare repositories. This commit was sponsored by Richard Hartmann.
Diffstat (limited to 'doc/direct_mode.mdwn')
-rw-r--r--doc/direct_mode.mdwn47
1 files changed, 27 insertions, 20 deletions
diff --git a/doc/direct_mode.mdwn b/doc/direct_mode.mdwn
index a6a2003a7..fc39956a3 100644
--- a/doc/direct_mode.mdwn
+++ b/doc/direct_mode.mdwn
@@ -4,8 +4,7 @@ git, and in turn point at the content of large files that is stored in
The advantage of direct mode is that you can access files directly,
including modifying them. The disadvantage is that most regular git
-commands cannot safely be used, and only a subset of git-annex commands
-can be used.
+commands cannot be used in a direct mode repository.
Normally, git-annex repositories start off in indirect mode. With some
exceptions:
@@ -21,7 +20,7 @@ exceptions:
Any repository can be converted to use direct mode at any time, and if you
decide not to use it, you can convert back to indirect mode just as easily.
Also, you can have one clone of a repository using direct mode, and another
-using indirect mode; direct mode interoperates.
+using indirect mode.
To start using direct mode:
@@ -52,7 +51,6 @@ computers, and manage your files, this should not be a concern for you.
## use a direct mode repository
You can use most git-annex commands as usual in a direct mode repository.
-A very few commands don't work in direct mode, and will refuse to do anything.
Direct mode also works well with the git-annex assistant.
@@ -63,23 +61,32 @@ the changes to other repositories for `git annex sync` there to pick up,
and will pull and merge any changes made on other repositories into the
local repository.
-While you generally will just use `git annex sync`, if you want to,
-you can use `git commit --staged`, or plain `git commit`.
-But not `git commit -a`, or `git commit <file>` ..
-that'd commit whole large files into git!
-
## what doesn't work in direct mode
-`git annex status` shows incomplete information. A few other commands,
-like `git annex unlock` don't make sense in direct mode and will refuse to
-run.
+A very few git-annex commands don't work in direct mode, and will refuse
+to do anything. For example, `git annex unlock` doesn't make sense in
+direct mode.
+
+As for git commands, direct mode prevents using any git command that would
+modify or access the work tree. So you cannot `git commit` or `git pull`
+(use `git annex sync` for both instead), or run `git status`.
+These git commands will complain "fatal: This operation must be run in a work tree".
+
+The reason for this is that git doesn't understand how git-annex uses the
+work tree in direct mode. Where git expects the symlinks that get checked
+into git to be checked out in the work tree, direct mode instead replaces
+them with the actual content of files, as managed by git-annex.
+
+There are still lots of git commands you can use in direct mode. For
+example, you can run `git log` on files, run `git push`, `git config`,
+`git remote add` etc.
+
+## forcing git to use the work tree in direct mode
-As for git commands, you can probably use some git working tree
-manipulation commands, like `git checkout` and `git revert` in useful
-ways... But beware, these commands can replace files that are present in
-your repository with broken symlinks. If that file was the only copy you
-had of something, it'll be lost.
+This is for experts only. You can lose data doing this, or check enormous
+files directly into your git repository, and it's your fault if you do!
+Also, there should be no good reason to need to do this, ever.
-This is one more reason it's wise to make git-annex untrust your direct mode
-repositories. Still, you can lose data using these sort of git commands, so
-use extreme caution.
+Ok, with the warnings out of the way, all you need to do to make any
+git command access the work tree in direct mode is pass it
+`-c core.bare=false`