Skip to content

Commit

Permalink
Use remote update instead of fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
gseguin committed Sep 19, 2012
1 parent d17eafa commit a482fea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions lib/project.js
Expand Up @@ -25,6 +25,11 @@ function fetch( repoDir, callback ) {
Git.exec( [ "fetch" ], callback );
}

function remoteUpdate( repoDir, callback ) {
Git( repoDir );
Git.exec( [ "remote", "update" ], callback );
}

function cleanup( project, callback ) {
var compiled = project.getCompiledDirSync();

Expand Down Expand Up @@ -214,4 +219,12 @@ Project.prototype.fetch = function( callback ) {
], callback );
}

Project.prototype.remoteUpdate = function( callback ) {
async.waterfall([
_.bind( this.getRepoDir, this ),
remoteUpdate
], callback );

}

module.exports.fetch = fetch;
4 changes: 2 additions & 2 deletions server.js
Expand Up @@ -108,7 +108,7 @@ app.post( '/post_receive', function ( req, res ) {

if ( project ) {
async.series([
_.bind( project.fetch, project ),
_.bind( project.remoteUpdate, project ),
_.bind( project.checkout, project )
],
function ( err ) {
Expand Down Expand Up @@ -137,7 +137,7 @@ app.get( '/v1/:owner/:repo', function ( req, res ) {
logger.log( "Fetching " + req.params.owner + "/" + req.params.repo );
var project = new Project( req.params.owner, req.params.repo );
async.waterfall([
_.bind( project.fetch, project ),
_.bind( project.remoteUpdate, project ),
function ( out ) {
res.send( ( out?"\n":"" ) + "OK" );
}
Expand Down

0 comments on commit a482fea

Please sign in to comment.