Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GIT_SUBMODULE fix: File not found .git/HEAD error #168

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Bjoe
Copy link

@Bjoe Bjoe commented Mar 5, 2020

  • I've checked this Git style guide. Yes
  • I've checked this CMake style guide. Yes
  • My change will work with CMake 3.2 (minimum requirement for Hunter). Yes
  • I will try to keep this pull request as small as possible and will try not to mix unrelated features. Yes

This PR will fix a "File not found .git/HEAD" error, when you use GIT_SUBMODULE in hunter_config()

@NeroBurner
Copy link

I can't reproduce the error you are fixing. Using the latest release v0.23.250 I modified Vulkan-Loader to use Vulkan-Headers from a submodule

https://github.com/NeroBurner/Vulkan-Loader/tree/hunter_with_submodule

with cmake -H. -B_build -DHUNTER_ENABLED=ON -DHUNTER_STATUS_DEBUG=ON the hunter step works as expected

can you provide a minimal configuration for a failing build and maybe the cmake output?

@Bjoe
Copy link
Author

Bjoe commented Mar 7, 2020

Yes sure ... let me figured out and I will send you when it fails ... give me some time

@Bjoe
Copy link
Author

Bjoe commented Mar 22, 2020

@NeroBurner Good questioned/finding :-) ... I already found an error in my first solution ...

To reproduce the error do following:

  1. Checkout your repo https://github.com/NeroBurner/Vulkan-Loader hunter_with_submodule branch
  2. Change into the folder cd Vulkan-Loader
  3. Remove subrepo git rm Vulkan-Headers
  4. Clone Vulkan headers git clone https://github.com/NeroBurner/Vulkan-Headers.git
  5. Add submodule git submodule add ./Vulkan-Headers Vulkan-Headers

Now try to build and you will get following error:

.......
-- Found Git: /usr/bin/git (found version "2.20.1") 
-- [hunter *** DEBUG *** 2020-03-22T14:32:36] Using git executable: /usr/bin/git

[hunter ** INTERNAL **] File not found: .git/refs/heads/hunter-1.2.133
[hunter ** INTERNAL **] [Directory:/home/developer/Development/hunter-wk/Vulkan-Loader/cmake/Hunter]

------------------------------ ERROR -----------------------------
    https://hunter.readthedocs.io/en/latest/reference/errors/error.internal.html
------------------------------------------------------------------

CMake Error at /home/developer/.hunter/_Base/Download/Hunter/0.23.250/0e6ce30/Unpacked/cmake/modules/hunter_error_page.cmake:12 (message):
Call Stack (most recent call first):
  /home/developer/.hunter/_Base/Download/Hunter/0.23.250/0e6ce30/Unpacked/cmake/modules/hunter_internal_error.cmake:13 (hunter_error_page)
  /home/developer/.hunter/_Base/Download/Hunter/0.23.250/0e6ce30/Unpacked/cmake/modules/hunter_pack_git_submodule.cmake:167 (hunter_internal_error)
  /home/developer/.hunter/_Base/Download/Hunter/0.23.250/0e6ce30/Unpacked/cmake/modules/hunter_config.cmake:94 (hunter_pack_git_submodule)
  cmake/Hunter/config.cmake:1 (hunter_config)
  /home/developer/.hunter/_Base/Download/Hunter/0.23.250/0e6ce30/Unpacked/cmake/modules/hunter_calculate_config_sha1.cmake:40 (include)
  /home/developer/.hunter/_Base/Download/Hunter/0.23.250/0e6ce30/Unpacked/cmake/modules/hunter_apply_gate_settings.cmake:155 (hunter_calculate_config_sha1)
  /home/developer/.hunter/_Base/Download/Hunter/0.23.250/0e6ce30/Unpacked/cmake/modules/hunter_finalize.cmake:73 (hunter_apply_gate_settings)
  /home/developer/.hunter/_Base/Download/Hunter/0.23.250/0e6ce30/Unpacked/cmake/modules/hunter_add_package.cmake:23 (hunter_finalize)
  external/CMakeLists.txt:45 (hunter_add_package)

@NeroBurner
Copy link

I think this will break if you add the submodule with an relative path. For example I can add the Vulkan Headers with git submodule add ../../NeroBurner/Vulkan-Headers and git will download the submodule with the same method as the parent git repo was downloaded (git+ssh, https, https with a user token)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants