Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make commit log relative to release branch #580

Merged
merged 8 commits into from Dec 31, 2020

Conversation

samouri
Copy link
Contributor

@samouri samouri commented Nov 19, 2020

summary

np provides a mechanism for specifying a release branch other than master. Notably main is a popular one. Am I correct in thinking that the current "Commit Log" generated will always be relative to master regardless of release branch?

Please let me know if I'm misunderstanding anything.
If this fix generally looks good, I'd be happy to add tests.

@samouri samouri changed the title commit-log should not be related to master, but the release branch. commit log should be relative to release branch. Nov 19, 2020
@sindresorhus
Copy link
Owner

We need to pick main or master automatically depending on whether they exist. I think we should add a utility to git-util.js called defaultBranch, that infers the default branch based on a simple heuristic, by checking in this order main, master, gh-pages. This utility could potentially be used here too:

const allowedBranches = releaseBranch ? [releaseBranch] : ['main', 'master'];

@sindresorhus sindresorhus changed the title commit log should be relative to release branch. Make commit log relative to release branch Nov 20, 2020
@samouri
Copy link
Contributor Author

samouri commented Nov 20, 2020

For some reason running npm test keeps freezing at a message claiming "prerequisite checks". Do you have any advice on how I can verify this change works?

source/git-util.js Outdated Show resolved Hide resolved
source/git-util.js Show resolved Hide resolved
source/git-util.js Outdated Show resolved Hide resolved
source/index.js Outdated Show resolved Hide resolved
source/git-util.js Outdated Show resolved Hide resolved
@sindresorhus
Copy link
Owner

Can you fix the merge conflict?

@samouri
Copy link
Contributor Author

samouri commented Dec 28, 2020

Can you fix the merge conflict?

Done!

I'm still concerned about this though.

@sindresorhus
Copy link
Owner

The current code crashes when you run np. Please manually test np after each change. The unit tests cannot catch everything.

@dopecodez
Copy link
Collaborator

The changes look good now, the error was being caused by a wrong import. I tried out the functionality as well and it looks it is working relative to release branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants