If a submodule isn't toplevel, git-annex breaks

What steps will reproduce the problem?

Make two non-empty repositories:

mkdir submod
cd submod
git init
touch README && git add README
git commit -a -m "first import of submodule"
cd ..

mkdir test
cd test
git init
touch README && git add README
git commit -a -m "first import of master"

Add first repository as a non-toplevel submodule:

git submodule add ../submod lib/submod

Setup git-annex for the submodule inside the other repository:

cd lib/submod
git annex init

What is the expected output? What do you see instead?

Expected:

init  ok
(Recording state in git...)

Got:

init  fatal: Could not switch to '../../../../lib': No such file or directory
git-annex: git config [Param "annex.uuid",Param "55D974D1-73E8-489E-B454-03D164664C82"] failed

What version of git-annex are you using? On what operating system?

3.20121011 compiled from git on Mac OS X 10.8

Please provide any additional information below.

  • git-annex read the path from the "worktree" variable in the git config.
  • The git config for a submodule is storen in the main repository, e.g. "../../.git/modules/lib/submod/config"
  • The path in that config is relative to the config file: "worktree = ../../../../lib/submod"
  • Git-annex expect the path to be relative to the current directory, which is why it fails.

Impressive analysis, thanks. I've fixed handling of relative core.worktree. done --Joey

Not quite there yet.

git-annex init works now, but there is still a problem with paths:

Using the same setup as previously, git-annex init now works:

cd lib/submod
git annex init

But adding a file failes:

git annex add big-file

Output:

add big-file (checksum...) 
git-annex: big-file: getFileStatus: does not exist (No such file or directory)
failed
(Recording state in git...)
git-annex: add: 1 failed

Debug:

[2012-10-16 13:59:26 CEST] read: git ["--git-dir=../../.git/modules/lib/submod","--work-tree=/Users/ptx/tmp/test-annex/test/lib/submod","ls-files","--others","--exclude-standard","-z","--","big-file"] [2012-10-16 13:59:26 CEST] read: git ["--git-dir=../../.git/modules/lib/submod","--work-tree=/Users/ptx/tmp/test-annex/test/lib/submod","diff","--name-only","--diff-filter=T","-z","--","big-file"] add big-file [2012-10-16 13:59:26 CEST] chat: git ["--git-dir=../../.git/modules/lib/submod","--work-tree=/Users/ptx/tmp/test-annex/test/lib/submod","check-attr","-z","--stdin","annex.backend","annex.numcopies","--"] (checksum...) [2012-10-16 13:59:26 CEST] chat: git ["--git-dir=../../.git/modules/lib/submod","--work-tree=/Users/ptx/tmp/test-annex/test/lib/submod","cat-file","--batch"]

git-annex: big-file: getFileStatus: does not exist (No such file or directory) failed

[2012-10-16 13:59:26 CEST] chat: git ["--git-dir=../../.git/modules/lib/submod","--work-tree=/Users/ptx/tmp/test-annex/test/lib/submod","hash-object","-w","--stdin-paths"]
[2012-10-16 13:59:26 CEST] feed: git ["--git-dir=../../.git/modules/lib/submod","--work-tree=/Users/ptx/tmp/test-annex/test/lib/submod","update-index","-z","--index-info"]
[2012-10-16 13:59:26 CEST] read: git ["--git-dir=../../.git/modules/lib/submod","--work-tree=/Users/ptx/tmp/test-annex/test/lib/submod","show-ref","--hash","refs/heads/git-annex"]
(Recording state in git...)
[2012-10-16 13:59:26 CEST] read: git ["--git-dir=../../.git/modules/lib/submod","--work-tree=/Users/ptx/tmp/test-annex/test/lib/submod","write-tree"]
[2012-10-16 13:59:26 CEST] chat: git ["--git-dir=../../.git/modules/lib/submod","--work-tree=/Users/ptx/tmp/test-annex/test/lib/submod","commit-tree","ed2f98d7105deed7482b3dde43426c177b360131","-p","refs/heads/git-annex"]
[2012-10-16 13:59:26 CEST] call: git ["--git-dir=../../.git/modules/lib/submod","--work-tree=/Users/ptx/tmp/test-annex/test/lib/submod","update-ref","refs/heads/git-annex","df49e7bef8409dff450ce549c40f4ab429ea3144"]
[2012-10-16 13:59:26 CEST] chat: git ["--git-dir=../../.git/modules/lib/submod","--work-tree=/Users/ptx/tmp/test-annex/test/lib/submod","cat-file","--batch"]
git-annex: add: 1 failed
Cute, it was making the wrong symlink and then noticed it was broken and reverted the add. At least my error unwind works! Anyway, fixed this too.
Comment by http://joeyh.name/ Tue Oct 16 20:28:03 2012
Comments on this page are closed.