diff --git a/lib/util/git.js b/lib/util/git.js index 5d86260..a7e8e73 100644 --- a/lib/util/git.js +++ b/lib/util/git.js @@ -1,5 +1,6 @@ 'use strict'; +var path = require('path'); var _ = require('lodash/fp'); var commitTemplate = '<%= (newContributor ? "Add" : "Update") %> <%= username %> as a contributor'; @@ -36,19 +37,23 @@ function getRepoInfo(cb) { }); } -function spawnCommand(args, cb) { +function spawnGitCommand(args, cb) { var git = spawn('git', args); git.stderr.on('data', cb); git.on('close', cb); } function commit(options, data, cb) { - spawnCommand(['add', '.'], function (error) { + var files = options.files.concat(options.config); + var absolutePathFiles = files.map(function (file) { + return path.resolve(process.cwd(), file); + }); + spawnGitCommand(['add'].concat(absolutePathFiles), function (error) { if (error) { return cb(error); } var commitMessage = _.template(options.commitTemplate || commitTemplate)(data); - spawnCommand(['commit', '-m', commitMessage], cb); + spawnGitCommand(['commit', '-m', commitMessage], cb); }); }