1

I'm trying to write a tool that inspects some git repositories.

I wondered what information is stored in a bare repository that regards submodules?

So far I assume that it's only the .gitmodules file. Would be nice if anyone could confirm this.

Trilarion
  • 9,942
  • 9
  • 61
  • 98
Onur
  • 4,749
  • 5
  • 37
  • 54
  • Related: [List submodules in a Git repository](https://stackoverflow.com/questions/12641469/list-submodules-in-a-git-repository) – Trilarion Nov 22 '19 at 15:28
  • Even more related: [https://stackoverflow.com/questions/26018979/get-bare-repository-submodule-hash](https://stackoverflow.com/questions/26018979/get-bare-repository-submodule-hash). – Trilarion Nov 22 '19 at 15:32

1 Answers1

2

Correct, .gitmodules is a file within the repository, you can't directly access it within a bare repo, but you can obtain it with git show HEAD:.gitmodules.

Trilarion
  • 9,942
  • 9
  • 61
  • 98
Oliver Matthews
  • 7,047
  • 3
  • 29
  • 32
  • 1
    I think I could if I browse the objects of tree type and look for an entry of type blob named `.gitmodules`, but that's not what I want anyway. – Onur Mar 18 '14 at 15:46
  • I wouldn't really have called that direct. Plus you'd need to parse the tree to figure out *which* blob you wanted (assuming it had ever been changed). – Oliver Matthews Mar 18 '14 at 15:58
  • I'd start with the tree of the HEAD. But that's just a theoretical exercise since I don't want to do that anyway. – Onur Mar 18 '14 at 16:00