texaganian
texaganian

Reputation: 23

trouble with git submodule in nested folder (not submodule) of local repo

I frequently find that I understand far less than I think I know... particularly when it gomes to git and github. I'm in that situation again and hope someone can help.

Background: This is all in Windows 7 with PowerShell v4 as my cli.

I've long kept my vim config within my local filesystem in a ~\.vim folder (managing symlinks for ~\vimfiles, ~\_vimrc, etc) and on github in a ".vimrc" repository, managing my plugins via pathogen and adding them to the repo as submodules. As long as I remembered to refresh my memnory before adding a new plugin, all went well.

But I recently decided I wanted to keep all of my most significant config files in a local ~\.dotfiles folder and on github in a similarly named repo (again, managing things with the appropriate symlinks).

I thought I had it all sussed out and ready to go until I tried to add the tabular plugin to my vim config.

First mistake was originally just cloning the tabular repo from github instead of adding it as a submodule. Second mistake was not looking up how to properly remove that cloned repo from my local repo. Maybe I did it wrong and caused my subsequent problems (I think I just deleted the tabular folder in ~.dotfiles.vim\bundle)

At any rate, after removing the cloned plugin repo folder, I tried to add the submodule and things blew up, as shown in the transcript below:

(note 1:    I originally just cloned the tabular repo (by mistake). That worked
            perfectly but perhaps I didn't remove the cloned repo correctly)
(note 2:    currently in ~\.dotfiles folder)

---<TRANSCRIPT>---
13:11:44|OBERON|316|# git submodule add git://github.com/godlygeek/tabular .vim/bundle/tabular$
fatal: Not a git repository: ../.git/modules/.vim/bundle/tabular$
Unable to checkout submodule '.vim/bundle/tabular'$

13:13:44|OBERON|318|# gci$
    Directory: C:\Users\arley.dealey\.dotfiles$
$
Mode                LastWriteTime     Length Name$
----                -------------     ------ ----$
d----        12/31/2014   1:12 PM            .git$
d----        12/30/2014   4:41 PM            .vim$
-a---          4/4/2014   4:46 PM       6304 .bashrc$
-a---        12/28/2014  11:01 AM       1328 .bash_profile$
-a---        12/28/2014  11:01 AM         10 .digrc$
-a---        12/28/2014  11:01 AM       1548 .inputrc$
-a---        12/28/2014  11:01 AM       1689 .pentadactylrc$
-a---        12/31/2014  10:47 AM      11687 .sig-library.txt$
-a---        12/31/2014  11:20 AM       2150 README.md$
$
13:13:50|OBERON|319|# git submodule add git://github.com/godlygeek/tabular .vim/bundle/tabular$
The following path is ignored by one of your .gitignore files:$
.vim/bundle/tabular$
Use -f if you really want to add it.$

13:15:11|OBERON|320|# git submodule add -f git://github.com/godlygeek/tabular .vim/bundle/tabular$
Adding existing repo at '.vim/bundle/tabular' to the index$
fatal: Not a git repository: .vim/bundle/tabular/../.git/modules/.vim/bundle/tabular$
Failed to add submodule '.vim/bundle/tabular'$

13:15:30|OBERON|321|# gci .vim/bundle$
    Directory: C:\Users\arley.dealey\.dotfiles\.vim\bundle$
$
Mode                LastWriteTime     Length Name$
----                -------------     ------ ----$
d----        12/29/2014   9:31 PM            airline$
d----        12/29/2014   9:31 PM            colorscheme-switcher$
d----        12/29/2014   9:31 PM            cs-solarized$
d----        12/29/2014   9:32 PM            fugitive$
d----        12/29/2014   9:32 PM            indentLine$
d----        12/29/2014   9:33 PM            pathogen$
d----        12/29/2014   9:33 PM            surround$
d----        12/31/2014   1:12 PM            tabular$
d----        12/29/2014   9:33 PM            vim-misc$
---<TRANSCRIPT>---

(Note 3: The tabular folder DID get created even though the submodule add failed)

So now I'm kind of befuddled and not certain what to do next.

Help?

[EDIT] Hmmm... I may have hosed it even worse than I thought. Trying a simple "git add ." from the root folder of the local repository now gets this:

16:59:06|OBERON|355|# git add .
fatal: Not a git repository: .vim/bundle/tabular/../.git/modules/.vim/bundle/tabular

Look at the path in the error message... WTF?

[EDIT] In case anyone is trying to follow along and getting a little lost, here is a tree diagram of the first three levels of the .dotfiles folder heirarchy:

17:35:50|OBERON|387|# tree ~\.dotfiles
.vim
├── README.md
├── autoload
│   └── pathogen.vim
├── bundle
│   ├── airline
│   ├── colorscheme-switcher
│   ├── cs-solarized
│   ├── fugitive
│   ├── indentLine
│   ├── pathogen
│   ├── surround
│   ├── tabular
│   └── vim-misc
├── colors
├── compiler
├── doc
├── ftdetect
├── ftplugin
├── indent
├── keymap
├── plugin
└── syntax
PowerShell
├── Microsoft.PowerShell_profile.ps1
├── PeterProvost_profile.ps1
├── nad-profile.ps1
└── profile.ps1
.bashrc
.bash_profile
.digrc
.inputrc
.pentadactylrc
.sig-library.txt
README.md

Upvotes: 2

Views: 779

Answers (1)

VonC
VonC

Reputation: 1324128

I would try first:

  • to clone again the dotfile repo
  • to check if the .vim/bundle/tabular is currently ignored

    git check-ignore -v -- .vim/bundle/tabular
    

(if it is ignored, modify, add and commit the appropriate .gitignore)

  • to add the submodule

    git submodule add https://github.com/godlygeek/tabular .vim/bundle/tabular
    

Upvotes: 1

Related Questions