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

Add Support for Downloading Package Using Commit Hash as the Reference #169

Closed
threeal opened this issue Oct 11, 2024 · 0 comments · Fixed by #170
Closed

Add Support for Downloading Package Using Commit Hash as the Reference #169

threeal opened this issue Oct 11, 2024 · 0 comments · Fixed by #170
Assignees

Comments

@threeal
Copy link
Owner

threeal commented Oct 11, 2024

This issue highlights a problem in the cdeps_download_package function, where the current implementation cannot be used to check out a package version based on a commit hash. Currently, cloning a Git repository with the -b option only works when using a branch or tag.

To support commit hashes, we need an alternative method to download and check out a specific version of a package. One approach is to fetch the specific reference and check out that reference after cloning the package. For example, while the current command to download the package is:

git clone -b <ref> --depth 1 <url> <dir> 

We can modify it to:

git clone --no-checkout --depth 1 <url> <dir>
git fetch origin --depth 1 <ref>
git checkout <ref>

This way, the function will support specifying versions using commit hashes, in addition to branch and tag names.

@threeal threeal self-assigned this Oct 11, 2024
@threeal threeal transferred this issue from threeal/git-checkout-cmake Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant