8
0

git-commit.js 816 B

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. const git = require( '../utils/git' );
  7. const PassThrough = require( 'stream' ).PassThrough;
  8. /**
  9. * Adds only modified files to git repository and commits them with provided message.
  10. *
  11. * Example:
  12. *
  13. * gulp exec --task git-commit --message "Commit message."
  14. *
  15. * @param {String} workdir
  16. * @param {Object} params
  17. * @returns {Stream}
  18. */
  19. module.exports = function executeGitCommit( workdir, params ) {
  20. const message = params.message;
  21. if ( !message ) {
  22. throw new Error( 'You must provide commit message with parameter: --message' );
  23. }
  24. git.commit( message, workdir );
  25. // Return dummy stream to inform gulp about finishing task.
  26. return new PassThrough();
  27. };