git-commit.js 799 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. * gulp exec --task git-commit --message "Commit message."
  13. *
  14. * @param {String} workdir
  15. * @param {Object} params
  16. * @returns {Stream} stream
  17. */
  18. module.exports = ( workdir, params ) => {
  19. const message = params.message;
  20. if ( !message ) {
  21. throw new Error( 'You must provide commit message with parameter: --message' );
  22. }
  23. git.commit( message, workdir );
  24. // Return dummy stream to inform gulp about finishing task.
  25. return new PassThrough();
  26. };