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

--mode=git doesn't seem to respect git hash provided to degit #337

Open
brunobely opened this issue Nov 11, 2021 · 5 comments
Open

--mode=git doesn't seem to respect git hash provided to degit #337

brunobely opened this issue Nov 11, 2021 · 5 comments

Comments

@brunobely
Copy link

When trying to degit a private repo I used the following command:

degit user/repo#commit my-project --mode=git

However, instead of having #commit cloned to the my-project directory, I had the latest commit. Not sure if WAI or if it's a bug but figured I'd file an issue.

@nake89
Copy link

nake89 commented Nov 15, 2021

I think you might've found a bug.
With this commit hash we are expecting version 2.2.2, but we get 2.8.4.

➜  /tmp degit Rich-Harris/degit#79d492b7820fa57ba1b2fc2020e74e87bf43f3a2 degit-test --mode=git
> cloned Rich-Harris/degit#79d492b7820fa57ba1b2fc2020e74e87bf43f3a2 to degit-test
➜  /tmp cd degit-test
➜  degit-test head -n3 CHANGELOG.md
# degit changelog

## 2.8.4
➜  degit-test

Somebody please correct me if I have done something wrong.

@visnaut
Copy link

visnaut commented Nov 25, 2021

On our project, we've also found that unless the provided commit hash is the most recent one for the repository, it will fail. In other words, if you choose the latest commit hash, degit will work just fine. But if that repository pushes a newer commit, the older hash stops working.

@nake89
Copy link

nake89 commented Nov 26, 2021

Hmmm... Could that be because it does git clone --depth 1?

@nake89
Copy link

nake89 commented Nov 29, 2021

Nevermind what I said in that previous comment. degit does not do depth 1 in _cloneWithGit method. Tiged does. I misremembered.

I noticed that there is a really good pull request that would add ability to use older commit hashes, subdirs and uses depth 1 for faster cloning. I have totally missed this before:
https://github.com/Rich-Harris/degit/pull/228/files

We've implemented subdirs and depth 1 in tiged, but have not added ability for older hashes.
I will see try to get that merged to tiged/tiged soon.

@nake89
Copy link

nake89 commented Mar 19, 2022

@brunobely @visnaut This has now been fixed in the newest version of tiged. https://github.com/tiged/tiged

That pull request did not work. So I had to do it myself. It was actually quite fun to figure it out.

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

3 participants