Add support for ${author} and ${branch} in templates#792
Add support for ${author} and ${branch} in templates#792esteban-aliverti wants to merge 1 commit intoMurmele:masterfrom
Conversation
| } | ||
| applyTemplate(t, files); | ||
|
|
||
| RepoView *view = RepoView::parentView(this); |
There was a problem hiding this comment.
I was not sure if there was an easier way to get the author and branch name at this point
There was a problem hiding this comment.
Good question. Because of the possibility to temporarly changing the username amd email, I think you need to take the one from the repoview
There was a problem hiding this comment.
When you change temporarly the username (click on the Author link above the commit message), still the old name is used.
| pattern.replace("$", "\\$"); | ||
| QRegularExpression re(pattern); | ||
| QRegularExpressionMatch match = re.match(templ); | ||
| int start = -1; |
There was a problem hiding this comment.
I didn't understand why were we calculating the offset instead of simply replacing all the variables and then checking where the placeholder for the cursor was left after all the substitutions.
This is what I'm doing not, but I may have missed something.
There was a problem hiding this comment.
Sorry for the late response. How do you know afterwards where to set the cursor?
This PR adds basic support for
${author}and${branch}variables in the commit templates.It is also possible to use a part of the branch name by adding a regular expression to the
${branch}variable. For example:${branch:ISSUE-[0-9]+}. In this case, if the branch name is something like "bugfix/ISSUE-1234_something", the value of the variable will be "ISSUE-1234"This is related to issue #457