-
Notifications
You must be signed in to change notification settings - Fork 899
Added an option to choose if commit message is prettified or not #619
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
Conversation
var newCommit = repo.ObjectDatabase.CreateCommit(newHeader.Author, | ||
newHeader.Committer, | ||
newHeader.Message, | ||
true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think any rewrite should be explicitly done by the user. I'm not all that familiar with this code, but it looks like the user gets to return the whole set, in which case they should run the text through the prettify function if they want to (e.g. the equivalent of the 'reword' option in git-rebase--interactive
would likely want to do this, as the user was asked for input), but we shouldn't change the data the user told us to put into the commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll create another issue to specifically deal with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. See #621
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't change the data the user told us to put into the commit.
This
@nulltoken, This is the behavior of the original version, without this a lot of unit tests fail. |
/// <param name="author">The <see cref="Signature"/> of who made the change.</param> | ||
/// <param name="committer">The <see cref="Signature"/> of who added the change to the repository.</param> | ||
/// <param name="message">The description of why a change was made to the repository.</param> | ||
/// <param name="prettifyMessage">True to prettify the message (converts crlf to lf), or false to leave it as is</param> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
converts crlf to lf
Beside this, this function does a little more than that:
- Remove empty lines from the beginning and end
- Remove trailing spaces from every line.
- Turn multiple consecutive empty lines between paragraphs into just one empty line.
- Ensure the commit message ends with a newline
- Remove every line starting with "#".
How about removing the (convert crlf to lf)
part from the param description and adding a <para>...</para>
describing this under the <summary/>
function xml doc node?
@nulltoken, I updated the commit amibar@146ba84 |
/// <param name="tree">The <see cref="Tree"/> of the <see cref="Commit"/> to be created.</param> | ||
/// <param name="parents">The parents of the <see cref="Commit"/> to be created.</param> | ||
/// <returns>The created <see cref="Commit"/>.</returns> | ||
/// <para> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this whole <para/>
section should be moved under the <summary/>
one so that it reads like
/// <summary>
/// Inserts a <see cref="Commit"/> into the object database, referencing an existing <see cref="Tree"/>.
/// <para>
/// Prettifying the message includes:
/// * Removing empty lines from the beginning and end.
/// * Removing trailing spaces from every line.
/// * Turning multiple consecutive empty lines between paragraphs into just one empty line.
/// * Ensuring the commit message ends with a newline.
/// * Removing every line starting with "#".
/// </para>
/// </summary>
Fixed the para |
👍 For me. Anyone else willing to chime in? |
No objection here |
@amibar Could you please rebase this on the latest vNext? |
@nulltoken, done |
@@ -191,12 +191,36 @@ public virtual Tree CreateTree(TreeDefinition treeDefinition) | |||
/// <param name="tree">The <see cref="Tree"/> of the <see cref="Commit"/> to be created.</param> | |||
/// <param name="parents">The parents of the <see cref="Commit"/> to be created.</param> | |||
/// <returns>The created <see cref="Commit"/>.</returns> | |||
[Obsolete] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duh. I overlooked this. Sorry. Could you please add a message to the attribute in order to redirect the user to the proper overload to use?
eg.
[Obsolete("This method will be removed in the next release. Please use CreateCommit(Signature, Signature, string, bool, Tree, IEnumerable<Commit>) instead.")]
Prettifing the message includes: * Removing empty lines from the beginning and end. * Removing trailing spaces from every line. * Turning multiple consecutive empty lines between paragraphs into just one empty line. * Ensuring the commit message ends with a newline. * Removing every line starting with "#". Note that this has nothing to do with the core.autocrlf option.
@nulltoken, updated [obsolete] message |
...and merged! @amibar Very nice job here! Thanks a lot 👍 |
This solves issue #611