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 "git blob hash" as available hash #380

Open
markrages opened this issue Jan 2, 2024 · 3 comments
Open

Add "git blob hash" as available hash #380

markrages opened this issue Jan 2, 2024 · 3 comments
Labels
enhancement Idea or request for a new feature

Comments

@markrages
Copy link

Description of the desired feature:

In my project, I wanted to use pooch as a cache for getting files off of Github.

It is more convenient to use Git's "blob hash" for this, rather than a normal SHA1 or whatever. This is because I can "git clone" a zero-depth repository and see these hashes without ever downloading the files. This saves a lot of time and bandwidth for a large Git repository.

Are you willing to help implement and maintain this feature?

I have implemented this already, in a monkey-patched way.

See https://github.com/markrages/svd_gdb/blob/master/svd_gdb/github_dl/update_registry.py for a script to create a Pooch registry from a remote Git server.

See https://github.com/markrages/svd_gdb/blob/master/svd_gdb/github_dl/github_dl.py for an example of use. (and the monkeypatched hash calculation.)

Is there any interest in supporting this?

@markrages markrages added the enhancement Idea or request for a new feature label Jan 2, 2024
@leouieda
Copy link
Member

Hi @markrages thanks for the suggestion and for showing an example! I hadn't seen this before and it's nice to know the use case exists.

This would definitely be worth adding. It won't add any dependencies from what I can tell (just a system call, right?). Do you think adding the git: hash prefix would be unique enough or are there multiple kinds of git blob hashes?

If you'd be willing to implement this, I'd be happy to merge. We'd need a test and an entry in the corresponding page in our docs (would be great to link to your project as an example).

@markrages
Copy link
Author

This would definitely be worth adding. It won't add any dependencies from what I can tell (just a system call, right?). Do you think adding the git: hash prefix would be unique enough or are there multiple kinds of git blob hashes?

That is a matter of some controversy: https://lwn.net/Articles/898522/

I think it would be prudent to distinguish SHA1 and SHA256 hashes, just in case.

I will get a patch put together.

@leouieda
Copy link
Member

👍🏽 thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Idea or request for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants