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 Git dependencies offline if tarball is available. #3000

Merged
merged 1 commit into from
May 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/resolvers/exotics/hosted-git-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type ExplodedFragment = {
hash: string,
};

export function explodeHostedGitFragment(fragment: string, reporter: Reporter): ExplodedFragment {
export function explodeHostedGitFragment(fragment: string, reporter: Reporter): ExplodedFragment {

const preParts = fragment.split('@');
if (preParts.length > 2) {
Expand All @@ -39,7 +39,7 @@ export function explodeHostedGitFragment(fragment: string, reporter: Reporter):
throw new MessageError(reporter.lang('invalidHostedGitFragment', fragment));
}

const userParts = fragment.split('/');
const userParts = fragment.split('/');

if (userParts.length >= 2) {

Expand Down Expand Up @@ -140,11 +140,6 @@ export default class HostedGitResolver extends ExoticResolver {
}

async resolveOverHTTP(url: string): Promise<Manifest> {
const shrunk = this.request.getLocked('tarball');
if (shrunk) {
return shrunk;
}

const commit = await this.getRefOverHTTP(url);
const {config} = this;

Expand Down Expand Up @@ -201,6 +196,12 @@ export default class HostedGitResolver extends ExoticResolver {
}

async resolve(): Promise<Manifest> {
// If we already have the tarball, just return it without having to make any HTTP requests.
const shrunk = this.request.getLocked('tarball');
if (shrunk) {
return shrunk;
}

const httpUrl = this.constructor.getGitHTTPUrl(this.exploded);
const httpBaseUrl = this.constructor.getGitHTTPBaseUrl(this.exploded);
const sshUrl = this.constructor.getGitSSHUrl(this.exploded);
Expand Down