-
Notifications
You must be signed in to change notification settings - Fork 784
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
Grunt: update commitplease for compatibility with git commit -v
#679
Conversation
Looks good to me, before merging I would just change the commit title to:
and insert a reference to the commitplease related issue. |
Generally the format would be "Build: Upgrade to commitplease 1.10.1" If you want to include a note about why, it would go in the long description. |
commitplease had a bug before 1.9.0 where it didn't properly handle the verbose flag `git commit -v`. jzaefferer/commitplease#19 (comment) This would lead to git diff for preview getting subjected to commit message validation, which could abort commits if it failed.
Thanks for the feedback. Amended the commit now. |
@mislav can you sign our CLA? http://contribute.jquery.org/CLA/ Depending on how fast my commitplease updates are done, I'd bump this directly to the new version. We need the signature for your other PR anyway. |
Signed the CLA. Let it just go on record that I don't like that commitplease is used in It breaks my git flow. I often make WIP commits that I intend to squash But the worst offense, especially on the first commit before I'm made aware |
That's actually not true. A large part of it is about automated changelogs across dozens of projects. |
Thank you for the feedback!
"[tmp]: " is often used in that case.
That's why the full commit message is dumped to the console for invalid commit messages, to recover what you previously typed. Its crude, but unfortunately the best we could come up with. You may have missed that since it also included the diff, which the next release of commitplease will address (assuming you use git 1.8.5+).
It actually tells you what's wrong at the top, but that might also have scrolled away due to the diff output below.
This is being addressed with the extend |
Sorry, I didn't know that. It would be nice if an automated system could infer the component from changed files, though. But I guess such heuristics would be difficult to define and brittle.
I've figured that out after trial-and-error, but it still disallows me to use
It does, I've read the error message. But it doesn't help you fixing the issue. As a new contributor, I was not aware what "components" were, what are the options and what is the format of specifying the compontent. Is it in square brackets? Is it a word separated by a colon? By inspecting the log, I've quickly learned, but still. A much friendlier technical solution for this would be to configure a |
I didn't know about |
Just like hooks need to be configured locally per-repo as well. If you could set up git hooks, then you could also set up the template. Here's an alternative to a template: a git hook that prepares the commit message before it opens in your text editor by listing the existing components: #!/bin/bash
# .git/hooks/prepare-commit-msg
set -e
file="$1"
mode="$2"
list_components() {
git log --no-merges --format='%s' | grep : | cut -d: -f1 | \
sort | uniq -c | sort -rn | head -10 | sed 's/^.\{1,\}[[:digit:]] //'
}
if [ -z "$mode" ]; then
c="$(git config core.commentchar || echo '#')"
{ echo "$c Please prefix the subject line with \"Component:\""
echo -n "$c Example components: "
list_components | xargs | sed 's/ /, /g'
cat "$file"
} > "${file}.new"
mv "${file}.new" "$file"
fi The effect is has on the default message when I
|
@mislav Very nice! |
Release commitplease 1.11.0 and updated this to use that version. Kept the rest of the commit message. |
commitplease had a bug before v1.9.0 where it didn't properly handle the verbose flag to
git commit
. This would lead to git diff for preview getting subjected to commit message validation, which could abort commits if it failed.See jzaefferer/commitplease#19 (comment)