Skip to content

Commit 25394f8

Browse files
authored
Merge pull request #76 from WordPress/fix/75-git-diff
Stage files before git diff-ing them
2 parents 0ef6459 + 162508b commit 25394f8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tasks/patch_wordpress.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
const request = require( 'request' );
1212
const exec = require( 'child_process' ).exec;
13+
const execSync = require( 'child_process' ).execSync;
1314
const spawn = require( 'child_process' ).spawn;
1415
const inquirer = require( 'inquirer' );
1516
const url = require( 'url' );
@@ -295,7 +296,11 @@ module.exports = function( grunt ) {
295296
}
296297

297298
const uploadPatchWithCredentials = function( username, password ) {
298-
const diffCommand = isSvn() ? 'svn diff --diff-cmd diff' : 'git diff';
299+
const diffCommand = isSvn() ? 'svn diff --diff-cmd diff' : 'git diff HEAD';
300+
301+
if ( ! isSvn() ) {
302+
execSync( 'git add .' );
303+
}
299304

300305
exec( diffCommand, ( error, result ) => {
301306
const client = xmlrpc.createSecureClient( {
@@ -316,6 +321,10 @@ module.exports = function( grunt ) {
316321
new Buffer( new Buffer( result ).toString( 'base64' ), 'base64' ),
317322
false, // never overwrite the old file
318323
], ( err ) => {
324+
if ( ! isSvn() ) {
325+
exec( 'git reset' );
326+
}
327+
319328
if ( null === err ) {
320329
grunt.log.writeln( 'Uploaded patch.' );
321330
done();

0 commit comments

Comments
 (0)