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

Get git commit id from tarball #106

Open
1 task
endersonmaia opened this issue Sep 5, 2023 · 3 comments
Open
1 task

Get git commit id from tarball #106

endersonmaia opened this issue Sep 5, 2023 · 3 comments
Labels
discussion enhancement New feature or request

Comments

@endersonmaia
Copy link

Describe the feature

I'd like to inform the user what is the git commit hash that is being downloaded when a branch or tag is passed.

Since giget doesn't depend on git, we'd need to assume that the tarball downloaded from the providers are generated using git archive.

If that's the case, the commit id could be retrieved from the tarball.

Example:

wget https://codeload.github.com/unjs/giget/tar.gz/tags/v1.1.2
zcat v1.1.2 | git get-tar-commit-id
8ddd2a4eb6045710c1bac9761e97152cf6af4b8a

8ddd2a4

Additional information

  • Would you be willing to help implement this feature?
@pi0
Copy link
Member

pi0 commented Sep 5, 2023

Interesting idea. I think somehow we should extract such metadata from tar archive. We use node-tar internally might be a way to retrieve commit id.

@pi0 pi0 added enhancement New feature or request discussion labels Sep 5, 2023
@endersonmaia
Copy link
Author

@pi0
Copy link
Member

pi0 commented Sep 5, 2023

Thanks. Seems reading is not that hard even if node-tar does not supports, we can easily find comment header: (update we can: https://github.com/isaacs/node-tar#class-tarpax)

> head release.tar
pax_global_header00006660000000000000000000000064143737264400014524gustar00rootroot0000000000000052 comment=8ddd2a4eb6045710c1bac9761e97152cf6af4b8a

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

No branches or pull requests

2 participants