diff --git a/README.md b/README.md index 18985d0..8a457bc 100644 --- a/README.md +++ b/README.md @@ -668,6 +668,12 @@ Default value: `master` The branch to pull from. E.g.: `master`, `develop` (optional). +#### options.rebase +Type: `Mixed`, +Default value: `false` + +Will set the rebase option. You can set it to `true` (Boolean) or 'preserve' (String). + ## The "gitfetch" task Download objects and refs from a repo. diff --git a/lib/command_pull.js b/lib/command_pull.js index e236e83..4dfeb89 100644 --- a/lib/command_pull.js +++ b/lib/command_pull.js @@ -6,6 +6,17 @@ var ArgUtil = require('flopmang'); module.exports = function (task, exec, done) { var argUtil = new ArgUtil(task, [ + { + option: 'rebase', + customFlagFn: function (arg) { + if (arg.value === true) { + return '--rebase=true'; + } else if (arg.value === 'preserve') { + return '--rebase=preserve'; + } + return null; + } + }, { option: 'remote', defaultValue: 'origin', diff --git a/test/pull_test.js b/test/pull_test.js index f85eab4..8729512 100644 --- a/test/pull_test.js +++ b/test/pull_test.js @@ -22,4 +22,26 @@ describe('pull', function () { .expect(['pull', 'origin', 'master']) .run(done); }); + + it('should accept --rebase option', function (done) { + var options = { + branch: 'master', + rebase: true + }; + + new Test(command, options) + .expect(['pull', '--rebase=true', 'origin', 'master']) + .run(done); + }); + + it('should accept --rebase option with preserve', function (done) { + var options = { + branch: 'master', + rebase: 'preserve' + }; + + new Test(command, options) + .expect(['pull', '--rebase=preserve', 'origin', 'master']) + .run(done); + }); });