mirror of
				https://github.com/rschamp/gh-pages.git
				synced 2025-11-04 12:51:11 +08:00 
			
		
		
		
	Clone using options.remote as the origin name
This commit is contained in:
		
							parent
							
								
									1188782205
								
							
						
					
					
						commit
						dfbdfe08f3
					
				@ -99,13 +99,14 @@ exports.clone = function clone(repo, dir, branch, options) {
 | 
			
		||||
      return Q.resolve();
 | 
			
		||||
    } else {
 | 
			
		||||
      return fs.makeTree(path.dirname(path.resolve(dir))).then(function() {
 | 
			
		||||
        var args = ['clone', repo, dir, '--branch', branch, '--single-branch'];
 | 
			
		||||
        var args = ['clone', repo, dir, '--branch', branch, '--single-branch',
 | 
			
		||||
                    '--origin', options.remote];
 | 
			
		||||
        if (options.depth) {
 | 
			
		||||
          args.push('--depth', options.depth);
 | 
			
		||||
        }
 | 
			
		||||
        return spawn(git, args).fail(function(err) {
 | 
			
		||||
          // try again without banch options
 | 
			
		||||
          return spawn(git, ['clone', repo, dir]);
 | 
			
		||||
          return spawn(git, ['clone', repo, dir, '--origin', options.remote]);
 | 
			
		||||
        });
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -29,9 +29,9 @@ function getRemoteUrl(dir, remote) {
 | 
			
		||||
      })
 | 
			
		||||
      .fail(function(err) {
 | 
			
		||||
        return Q.reject(new Error(
 | 
			
		||||
            'Failed to get remote.' + remote + '.url (task must either be run in a ' +
 | 
			
		||||
            'git repository with a configured ' + remote + ' remote or must be ' +
 | 
			
		||||
            'configured with the "repo" option).'));
 | 
			
		||||
            'Failed to get remote.' + remote + '.url (task must either be ' +
 | 
			
		||||
            'run in a git repository with a configured ' + remote + ' remote ' +
 | 
			
		||||
            'or must be configured with the "repo" option).'));
 | 
			
		||||
      });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user