forum/Detached git work tree?git-annexhttp://git-annex.branchable.com/forum/Detached_git_work_tree__63__/git-annexikiwiki2013-11-27T22:47:37Zcomment 1http://git-annex.branchable.com/forum/Detached_git_work_tree__63__/comment_1_28ac35a325fba250721d9f1b7c994960/joeyh.name2013-11-27T22:47:37Z2013-01-14T16:32:51Z
Recent versions of git-annex support these variables. I haven't tested it extensively, but AFAIK it works.
Having issues herehttp://git-annex.branchable.com/forum/Detached_git_work_tree__63__/comment_2_7128c26bbc8efea04a5a317edf0ca9f2/Alex2013-11-27T22:47:37Z2013-02-23T14:44:15Z
<p>I'm trying to use git-annex with vcsh, and it doesn't seem to be respecting the GIT_WORK_TREE and GIT_DIR variables vcsh sets. If I try it manually, the same happens.</p>
<p>Any time I try to invoke a git-annex subcommand (init, add) via vcsh (vcsh $repo annex init/add/etc) it spits out an error that "git-annex: Not in a git repository."</p>
<p>I'd really like this to work, so that I can manage the bigger files in my home with topic-based annexes alongside plain-git repos for dotfiles.</p>
comment 3http://git-annex.branchable.com/forum/Detached_git_work_tree__63__/comment_3_a3c22f905748ff2c803e8621c74a87a0/joeyh.name2013-11-27T22:47:37Z2013-02-23T15:01:57Z
@Alex, you forgot to say what version of git-annex you are having trouble with.
comment 4http://git-annex.branchable.com/forum/Detached_git_work_tree__63__/comment_4_8063921241760458349e7cb0cadf3d4e/Alex2013-11-27T22:47:37Z2013-02-23T15:07:52Z
3.20130216.1 from Hackage - I packaged it for Exherbo specifically to try this, and installed it about two hours ago.
comment 5http://git-annex.branchable.com/forum/Detached_git_work_tree__63__/comment_5_4510a787255cb03e7d0c3e7b830b7d52/joeyh.name2013-11-27T22:47:37Z2013-02-23T16:44:48Z
<p>So, I found and fixed that bug. It really seems to be working now. Although I've thought that at least twice before!</p>
<p>There is an important caveat though, with using <code>GIT_DIR</code> and/or <code>GIT_WORK_TREE</code>.</p>
<p>git-annex needs to check in symlinks that point at the git repository. If using <code>GIT_DIR</code>, those symlinks do not look like "-> .git/annex/objects/"; they instead point off to some git repository elsewhere, as a relative path. For example they could look like "-> ../gitrepo/annex/objects/". Similar when using <code>GIT_WORK_TREE</code>.</p>
<p>But this is a problem if you want to use the same git repo elsewhere, with a git work tree and repo that are not set up the same relative to one-another, because the links will all be wrong. So, if you decide to use <code>GIT_DIR</code> or <code>GIT_WORK_TREE</code> with git-annex, any clone of the repository will need to place the git directory in the same place relative to the working tree.</p>
<p>If you later want to change the relative paths between git directory and work tree, it would need to be changed in all clones of the repository, and then you could use <code>git annex fix</code> to update the symlinks.</p>
comment 6http://git-annex.branchable.com/forum/Detached_git_work_tree__63__/comment_6_ffd9c67ecc5b46ae98996018573f5591/Alex2013-11-27T22:47:37Z2013-02-23T21:23:18Z
<p>Cool, thanks! The caveat shouldn't be much of a problem for my use case - with vcsh, the workdir is always $HOME, and I'm using the recommended mr-based workflow so the gitdir will always be ~/.config/vcsh/repo.d/$name.git in each clone.</p>
<p>EDIT: fix erroneous path</p>
Further possible issueshttp://git-annex.branchable.com/forum/Detached_git_work_tree__63__/comment_7_36ca007643c983604fc4aed6ec8cb3d2/Alex2013-11-27T22:47:37Z2013-02-23T23:17:43Z
Mm, looking at the actual code changes it may still not work with vcsh - since multiple GIT_DIRS share one GIT_WORKTREE, some symlinks will point to ~/.config/vcsh/repo.d/foo.git and some will point to ~/.config/vcsh/repo.d/bar.git. When git annex is invoked with GIT_DIR='~/.config/vcsh/repo.d/bar.git', with the changes you made files annexed by ~/.config/vcsh/repo.d/foo.git will still match isLinkToAnnex.
comment 8http://git-annex.branchable.com/forum/Detached_git_work_tree__63__/comment_8_b7a2da4fbace7156e11c48a496a19dc9/joeyh.name2013-11-27T22:47:37Z2013-02-23T23:23:01Z
That should not be a problem, because git-annex only acts on files that <code>git ls-files</code> lists.
comment 9http://git-annex.branchable.com/forum/Detached_git_work_tree__63__/comment_9_f9fa237a693d28178f0451799209f7e2/Alex2013-11-27T22:47:37Z2013-02-24T00:52:52Z
Alright then, sounds like it should be perfect! Thanks for the quick response!
comment 10http://git-annex.branchable.com/forum/Detached_git_work_tree__63__/comment_10_656c737772bf92be2c7a2f33bd2bb0f0/Alex2013-11-27T22:47:37Z2013-02-24T12:04:21Z
<p>Been using it a few hours now and it works like a charm - first thing I did was get a sitemap of the LCA and FOSDEM talks and use addurl --fast on them, since I've been wanting to do that since I saw the lightning talk last year at FOSDEM.</p>
<p>Thanks again for making this awesome utility!</p>