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

allow submodule for local type #206

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

RexWzh
Copy link
Contributor

@RexWzh RexWzh commented Sep 11, 2024

Replace shutil.copytree with Repo.clone_from for Local type in url_to_repo.

This change ensures the cached repo is clean and fixes bugs when dealing with submodule repositories.

To reproduce the issue:

# git clone https://github.com/Lean-zh/IMO_Resource.git && cd IMO_Resource
# git submodule update --init --recursive
from lean_dojo import LeanGitRepo
LeanGitRepo.from_path('IMO_2024')
# ValueError: Error converting ref to commit hash: SHA is empty, possible dubious ownership in the repository at /tmp/tmp4n56k8qf/IMO_2024.

The submodule is in fact not a complete Git repo, which leads to errors:

❯ cat IMO_2024/.git
gitdir: ../.git/modules/IMO_2024

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.

1 participant