Modern versions of git no longer put a .git directory in submodules, instead there is a .git regular text file that contains a relative path to where the .git dir can be found (inside the .git/submodules of the root repo).
I'm afraid I haven't looked at what tests etc. might need to be modified if you do want to merge this in.
"Modern" is a bit vague. Would be nice to know which git version made the change, so we can test with "old" and "new" git.
Tests are essential. From README:
If at all possible, add a test whenever you fix a bug or implement
a feature. If you can write a test that has no dependencies (e.g.
no need to execute "git" or "hg" or whatever), add it to
tests/test-simple. Otherwise, add it to the appropriate
VC-specific test script, e.g. tests/test-git if it needs to be
able to run git.
Off-the-cuff, I'd lean towards adding tests to tests/test-simple: don't actually use git, just setup a fake little git working dir with a submodule. That way you can fake up the "old" way and the "new" way, and both code paths get tested without needing old and new versions of git around. I could be wrong on this, but give it a shot. Lots of examples in tests/test-simple.
I can't remember how nul-safe read_first_line() is. It's in common.c. A second pair of eyes on that code would be a good thing (hint! hint!).