2

I had cloned a repository to PatchBasedInpaintingDevelop. I've been working in there for a while with no problems. Then I decided to rename the folder locally. I did 'mv PatchBasedInpaintingDevelop PatchBasedInpainting' and now git status complains about submodules, saying:

doriad@daviddesktop:/media/portable/Projects/PatchBasedInpainting$ git status
fatal: Not a git repository: /media/portable/Projects/PatchBasedInpaintingDevelop/.git/modules/ITKQtHelpers

Is there a way to do this move without breaking the submodule structure?

David Doria
  • 9,873
  • 17
  • 85
  • 147

1 Answers1

0

It seems your .gitmodules file reference the submodules using an absolute path.

Try using a relative path for said submodules.
(as shown, for instance, in "Managing a set of related repositories relative in Git")

submodule.<name>.path

Defines the path, relative to the top-level directory of the git working tree, where the submodule is expected to be checked out.
The path name must not end with a /.
All submodule paths must be unique within the .gitmodules file.

The only other solution is to fix all the absolute paths (as in this script)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • The only thing that seems to have the full path are submodule/.git/modules/SubModName/config , in the 'worktree' line: ./.git/modules/ITKQtHelpers/config: worktree = /media/portable/Projects/PatchBasedInpaintingDevelop/ITKQtHelpers – David Doria Nov 06 '12 at 19:00
  • I also found that SubModName/.git has a gitdir: line: ITKQtHelpers/.git:gitdir: /media/portable/Projects/PatchBasedInpaintingDevelop/.git/modules/ITKQtHelpers – David Doria Nov 06 '12 at 19:02
  • @DavidDoria how those submodules are declared in the `.gitmodules` file? – VonC Nov 06 '12 at 22:13
  • 1
    [submodule "ITKQtHelpers"] path = ITKQtHelpers url = ../ITKQtHelpers.git – David Doria Nov 07 '12 at 02:09