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

Resolve GitHub http urls with hash #1649

Closed
wants to merge 2 commits into from

Conversation

backflip
Copy link

@backflip backflip commented Nov 3, 2016

Summary

We use GitHub http urls with commit hashes. Currently, they aren't properly resolved. #1393 did fix this for SSH urls only.

Test plan

npm test with a new test to check whether a hash is appended to the resolved getGitHTTPUrl url.

@@ -38,6 +38,17 @@ test('getGitHTTPUrl should return the correct git github SSH url', () => {
expect(GitHubResolver.getGitSSHUrl(fragment)).toBe(expected);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the test getGitHTTPUrl should return the correct git github SSH url actually run GitHubResolver.getGitSSHUrl?

@backflip
Copy link
Author

backflip commented Nov 3, 2016

Though judging from https://github.com/yarnpkg/yarn/pull/202/files I'm not even sure getGitHTTPUrl is used in this specific use case. Could someone clarify how the resolving mechanism for https://github.com/user/repo.git#commithash works?

@backflip
Copy link
Author

backflip commented Nov 3, 2016

Hm, I have problems reproducing my initial issue. I wasn't able to install https://github.com/unic/gulp-raster.git#acd044d950d9ed65870b3c39cb6294a09174d166 (it always resulted in the latest master branch commit). However, I don't seem to be able to reproduce this anymore (still on 0.16.1, no update in the meantime).

@@ -31,7 +31,8 @@ export default class GitHubResolver extends HostedGitResolver {
}

static getGitHTTPUrl(parts: ExplodedFragment): string {
return `https://${this.hostname}/${parts.user}/${parts.repo}.git`;
return `https://${this.hostname}/${parts.user}/${parts.repo}.git` +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import url from 'url';
...
return url.format({
  protocol: 'https:',
  host: this.hostname,
  path: `${parts.user}/${parts.repo}.git`,  
  hash: parts.hash,
});

should be a bit nicer

@bestander
Copy link
Member

@backflip could you rebase?

@bestander
Copy link
Member

If this is still relevant feel free to rebase and reopen

@bestander bestander closed this Mar 3, 2017
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.

3 participants