Skip to content

Commit

Permalink
fix(git tag): get latest tag, regardless of branch for workflows that…
Browse files Browse the repository at this point in the history
… rely on git-flow releases
  • Loading branch information
seivan committed Nov 2, 2016
1 parent 3fed727 commit 4880030
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tasks/lib/set-defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function setDefaults() {
debug('setting defaults');
this.options = {};
this.cmd = {
gitTag: 'git describe --tags --abbrev=0',
gitTag: 'git tag | tail -n1',
gitRepoUrl: 'git config --get remote.origin.url',
gitLog: null,
gitLogNoTag: null
Expand Down
2 changes: 1 addition & 1 deletion test/git_changelog_generate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('git_changelog_generate.js', function() {
expect(changelog).to.have.property('cmd');

expect(changelog).to.have.deep.property('cmd.gitTag');
expect(changelog.cmd.gitTag).to.equal('git describe --tags --abbrev=0');
expect(changelog.cmd.gitTag).to.equal('git tag | tail -n1');

expect(changelog).to.have.deep.property('cmd.gitRepoUrl');
expect(changelog.cmd.gitRepoUrl).to.equal('git config --get remote.origin.url');
Expand Down

4 comments on commit 4880030

@Ku3mi41
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

| tail
didn't work on Windows systems.

@seivan
Copy link
Contributor Author

@seivan seivan commented on 4880030 May 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ku3mi41 Can you pipe like that in Windows to begin with? In that case, what comes builtin with Windows that works like tail, I'm sure we can add a condition there.

@Ku3mi41
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seivan problem that Windows have no tail analog (at least by default). So I see only universal decision:

  1. get all tags without | tail
git tag
v0
v1
v2

  1. after that split and slice stdout in get-previous-tag.js
var tags = stdout.split('\n');
var lastTag = tags.slice(-2,-1);

@seivan
Copy link
Contributor Author

@seivan seivan commented on 4880030 May 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ku3mi41 To be fair, I would see that as a windows solution conditional because how elegant just tail works :)

But it's not up to me. Perhaps you could create a ticket and continue there?

Please sign in to comment.