FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Introduce `git_email_create`; deprecate `git_diff_format_email` by ethomson · Pull Request #6061 · libgit2/libgit2 · GitHub

Introduce git_email_create; deprecate git_diff_format_email - #6061

Merged
ethomson merged 10 commits into
mainfrom
ethomson/email
Sep 21, 2021
Merged

ethomson merged 10 commits into
mainfrom
ethomson/email

Conversation

Copy link
Copy Markdown
Member

This does some refactoring on the git_diff_format_email functionality to address some minor issues. Since these are breaking changes, it introduces git_email_create with the changes. (I expect that there will be a future git_email_apply that mirrors git am.)

The differences are:

  1. git_diff_format_email can take a git_buf an append to it across subsequent calls. (Behavior which is, in fact, codified in a test.) This behavior is uncommon (possibly unique to git_diff_format_email). git_email_create always clears the buffer before placing data into it.

  2. Much of the data in the options structure is, in fact, not optional. Non-optional arguments are now just arguments.

Per (1), I expect to introduce a git_email_create_from_commits or _from_revspec that produces a series of emails to provide a similar behavior to format_email (based on feedback).

ethomson force-pushed the ethomson/email branch 2 times, most recently from 90887ac to 110c49e Compare September 18, 2021 12:23
Create `git_email_*` which will encapsulate email creation and
application, and `git_email_create_from_commit` in particular, which
creates an email for a single commit.
Introduce a function to create an email from a diff and multiple inputs
about the source of the diff.

Creating an email from a diff requires many more inputs, and should be
discouraged in favor of building directly from a commit, and is thus in
the `sys` namespace.
Allow a `0` patch index and `0` patch count; in this case, simply don't
display these in the email.
Move the `git_diff_commit_as_email` function to use `email_create`.
Introduce `git_email__append_from_diff` so that we don't always
overwrite the input buffer.
`git format-patch` includes binary diffs by default when creating
emails.  Match this behavior.
`git format-patch` includes diffs with rename detection enabled by
default when creating emails.  Match this behavior.
`git_diff_format_email` is deprecated in favor of `git_email_create`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL