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

[bug] zcomet load githubuser/repo@ref submodule error #21

Open
olets opened this issue Oct 30, 2024 · 3 comments
Open

[bug] zcomet load githubuser/repo@ref submodule error #21

olets opened this issue Oct 30, 2024 · 3 comments

Comments

@olets
Copy link

olets commented Oct 30, 2024

Expected

Submodules are handled succesfully, whether the default branch is loaded

zcomet user/repo-with-submodule

or some other ref is

zcomet user/repo-with-submodule@ref

Actual

zcomet loading a repo with a submodule works when loading the default branch, but leads to an error.

Where you'd expect the last line of output to be

% zcomet load user/repo-with-submodule
# snip
Submodule path '<submodule name>': checked out '<sha>'
%

there are additional lines

% zcomet load <user>/<repo>@<branch>
# snip
Submodule path '<submodule name>': checked out '<sha>'
fatal: not a git repository: ../.git/modules/<submodule name>
fatal: could not reset submodule index
Could not checkout `<branch>'.
%

Steps to reproduce

  1. Create a new GitHub repo
  2. Add a submodule to default branch, commit, and push
  3. zcomet load <github user>/<github repo>@$(git rev-parse @)

Here's a demo repo https://github.com/olets/submoduled

It has branches

• < main < no-submodule-changes-compared-to-main
         \
           adds-submodule-zcomet
  • main has https://github.com/olets/zsh-abbr as a submodule
  • zcomet load olets/submoduled should work
  • zcomet load olets/submoduled@no-submodule-changes-compared-to-main should work but doesn't for me
  • zcomet load olets/submoduled@adds-submodule-zcomet should work but doesn't for me

More info

I'm on

  • zsh 5.9 (arm-apple-darwin21.3.0)
  • OSTYPE darwin21.3.0
  • git version 2.47.0
  • latest zcomet as of this writing

I haven't looked into how zcomet load works. (Resisting for now after getting sucked into many time consuming open source adventures in the last few days heh). Notably this error happens when one git equivalent,

git clone --recurse-submodules --single-branch --branch <branch> https://github.com/<user>/<repo>

succeeds.

@olets olets changed the title [bug] submodule error when loading a ref with zcomet load githubuser/repo@ref [bug] zcomet load githubuser/repo@ref submodule error Oct 30, 2024
@agkozak
Copy link
Owner

agkozak commented Oct 30, 2024

Thanks for the admirably detailed report! I'll get back to you.

@agkozak
Copy link
Owner

agkozak commented Nov 9, 2024

I can't get any of my systems to produce your error message, but I see that there is a bug in zcomet related to how Git submodules work. I should have time to address it on Monday. I'll send you a message when I'm ready for you to test the fix, OK?

@olets
Copy link
Author

olets commented Nov 9, 2024

Don't rush for my sake - my need was brief. Happy to help test though.

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

No branches or pull requests

2 participants