Commit 971ed753 by Edward Thomson

email: introduce 'append_from_diff'

Introduce `git_email__append_from_diff` so that we don't always
overwrite the input buffer.
parent f407d3fa
......@@ -5,6 +5,8 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
#include "email.h"
#include "buffer.h"
#include "common.h"
#include "diff_generate.h"
......@@ -187,7 +189,7 @@ static int append_patches(git_buf *out, git_diff *diff)
return error;
}
int git_email_create_from_diff(
int git_email__append_from_diff(
git_buf *out,
git_diff *diff,
size_t patch_idx,
......@@ -227,6 +229,29 @@ int git_email_create_from_diff(
return error;
}
int git_email_create_from_diff(
git_buf *out,
git_diff *diff,
size_t patch_idx,
size_t patch_count,
const git_oid *commit_id,
const char *summary,
const char *body,
const git_signature *author,
const git_email_create_options *given_opts)
{
int error;
git_buf_sanitize(out);
git_buf_clear(out);
error = git_email__append_from_diff(out, diff, patch_idx,
patch_count, commit_id, summary, body, author,
given_opts);
return error;
}
int git_email_create_from_commit(
git_buf *out,
git_commit *commit,
......
/*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_email_h__
#define INCLUDE_email_h__
#include "common.h"
#include "git2/email.h"
extern int git_email__append_from_diff(
git_buf *out,
git_diff *diff,
size_t patch_idx,
size_t patch_count,
const git_oid *commit_id,
const char *summary,
const char *body,
const git_signature *author,
const git_email_create_options *given_opts);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment