Permalink
Browse files

Use `remote update` instead of `fetch`

  • Loading branch information...
1 parent d17eafa commit a482feac849f5c9f981d552484f79101a81395db @gseguin committed Sep 19, 2012
Showing with 15 additions and 2 deletions.
  1. +13 −0 lib/project.js
  2. +2 −2 server.js
View
@@ -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();
@@ -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;
View
@@ -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 ) {
@@ -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" );
}

0 comments on commit a482fea

Please sign in to comment.