Skip to content

using gitinfo2 within a git submodule #26

@anbe42

Description

@anbe42

Hi,

gitinfo2 does not work if the repo is a git submodule, because the .git directory is located elsewhere (in the parent repo), referenced in a .git file as e.g. gitdir: ../.git/modules/my.submodule

For the hook script it is easy to find the correct GIT_DIR: git rev-parse --git-dir

For the style it is more complicated to do this ... I only implemented a proof-of-concept solution that works for building within the root of the submodule, it does no search through the parent directories. The tex part could surely be improved :-)
I haven't even thought about how this should work for nested submodules.
My preliminary patch is attached.

Andreas

PS: Another hint: The no-op command I use for updating gitHeadInfo.gin (especially refreshing dirty state) is git checkout (it does not change the repo, even if something is staged/uncommitted, but it runs the hooks)), integrated somewhere in my Makefile based build system.

0001-preliminary-support-for-usage-within-a-git-submodule-patch.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions