Skip to content

Commit

Permalink
feat: improve git log synthax command to use the branch name
Browse files Browse the repository at this point in the history
and permit to run the command for every commitish
(branch, tag, sha1)
  • Loading branch information
pmiossec committed Jan 31, 2016
1 parent 4baa075 commit 4ce6128
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tasks/lib/get-gitlog-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var debug = require('debug')('changelog:getGitLogCommands');

function getGitLogCommands() {
debug('getting log commands');
this.cmd.gitLog = 'git log ' + this.options.branch_name + ' --grep="%s" -E --format=%s %s..HEAD';
this.cmd.gitLog = 'git log --grep="%s" -E --format=%s %s..' + (this.options.branch_name ? this.options.branch_name : 'HEAD');
this.cmd.gitLogNoTag = 'git log ' + this.options.branch_name + ' --grep="%s" -E --format=%s';
}

Expand Down
3 changes: 2 additions & 1 deletion test/git_changelog_generate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ describe('git_changelog_generate.js', function() {
changelog.options.branch_name = branch_name;
changelog.getGitLogCommands();

expect(changelog.cmd.gitLog).to.include('git log ' + branch_name);
expect(changelog.cmd.gitLog).to.include('git log ')
.and.include('..' + branch_name);
expect(changelog.cmd.gitLogNoTag).to.include('git log ' + branch_name);
});

Expand Down

0 comments on commit 4ce6128

Please sign in to comment.