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

Command to edit default commit format #51

Closed
eaigner opened this issue Nov 2, 2013 · 11 comments
Closed

Command to edit default commit format #51

eaigner opened this issue Nov 2, 2013 · 11 comments

Comments

@eaigner
Copy link

eaigner commented Nov 2, 2013

During the setup there was no option to specify a default commit format. I apologise in advance if I overlooked such a feature.

In my case I want to remove all the squashed commit information from the default commit text, since this info is not relevant in any case and just takes up space.

@codenamev
Copy link
Collaborator

This is a great idea. I'll see if I can add this in before the end of the week.

@eaigner
Copy link
Author

eaigner commented Nov 6, 2013

I suppose you already use some sort of template (ERB) for this?

A command that pops up that template for editing would be the easiest thing I think.

@codenamev
Copy link
Collaborator

We're currently hijacking the git's native SQUASH_MSG and just appending arbitrary data. See append_to_squashed_commit_message(message):
https://github.com/reenhanced/gitreflow/blob/master/lib/git_reflow.rb#L254

Off the top of my head I was thinking about just using a git-config var to store the value of the template you'd want to use and then just using mustache-style escaping like "This fixes {{pull_request_number}}"

You're more than welcome to take a stab at this if you have a better idea. Just let me know so I don't step on your toes.

@eaigner
Copy link
Author

eaigner commented Nov 6, 2013

I would, unfortunately I'm swamped atm.

@codenamev codenamev reopened this Nov 6, 2013
@bakesteve
Copy link

just trying out git reflow, and really liking what I've seen - this is one we'd love to have.
from a wish list point of view, something like:

options[Message] || OriginalPullRequest.Title

Closes #OriginalPR.Number

OriginalPullRequest.Description

be happy to try and grab some time to make this happen.
though from:
https://github.com/reenhanced/gitreflow/blob/master/lib/git_reflow.rb#L264
I was expecting to get a message saying "Closes #XXX" but instead I'm getting "Squashed commit"
any pointers before I start digging?
EDIT:
think this is a windows thang.
missed a message saying mv: cannot stat./tmp_squash_msg': No such file or directory`
assuming this is one of the old "sane dev environment" joys...

@codenamev
Copy link
Collaborator

@bakesteve sure give it a go!

Ah, yeah we've only tested gitreflow on Ubuntu and OSX...

We've recently refactor the file you referenced to here: https://github.com/reenhanced/gitreflow/blob/master/lib/git_reflow/git_helpers.rb#L60

I imagine you're getting that error message since the file ./tmp_squash_msg doesn't exist yet. Adding something like touch ./tmp_squash_msg before that gets run should fix your issue.

Let me know where I can help.

@codenamev
Copy link
Collaborator

@Shalmezad
Copy link
Contributor

Going to take a look at this later this week if you don't mind.

Any particular way you want this done?
(I'm thinking uses variable in ~/.gitconfig.reflow if it's available [will add default on setup], otherwise shows a warning and uses default, document the mustache variables available in the README, etc).

@codenamev
Copy link
Collaborator

That all sounds good. I'm a little hesitant on adding mustache as a dependency for this as it's such a small feature. Maybe start with it and then see if it's easy enough to implement without it?

@Shalmezad
Copy link
Contributor

Don't think we'll need the mustache gem unless you see value in using it.
Will have to do some digging to make sure this will work fine, but I'm leaning towards a gsub paired with self.send (evaluate mustache variables as calls), or having a preset dictionary of possible values that can be used.

def blah
  return "hello"
end
your_commit_message = "this will say {{blah}}"
your_commit_message.gsub(/\{\{([a-zA-Z_]+[a-zA-Z0-9_]*)\}\}/){self.send($1)}

"this will say hello"

@codenamev codenamev moved this from Backlog to In Progress in 0.9 Release Apr 26, 2018
@codenamev codenamev moved this from In Progress to In Review in 0.9 Release May 1, 2018
@codenamev codenamev moved this from In Review to Complete in 0.9 Release May 1, 2018
@codenamev
Copy link
Collaborator

This was completed with 8eb3391.

It introduced a new commit message template (MERGE_COMMIT_TEMPLATE ), in addition to the PULL_REQUEST_TEMPLATE (which is loaded from the standard paths that GitHub expects them), and adds the ability to define {{ }} template tags in both this new template and PR template. Anything inside of the {{ }} is sent to the GitReflow module using public_send; so any method available to GitReflow is available to templates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
0.9 Release
Complete
Development

No branches or pull requests

4 participants