From d383c39b3bc9a2bd5e68882db9a12e64ccd262a4 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Thu, 28 Apr 2016 12:47:14 -0400 Subject: Introduce `git_signature_from_buffer` Allow users to construct a signature from the type of signature lines that actually appear in commits. --- include/git2/signature.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/git2') diff --git a/include/git2/signature.h b/include/git2/signature.h index feb1b4073..7a2a0238a 100644 --- a/include/git2/signature.h +++ b/include/git2/signature.h @@ -62,6 +62,19 @@ GIT_EXTERN(int) git_signature_now(git_signature **out, const char *name, const c */ GIT_EXTERN(int) git_signature_default(git_signature **out, git_repository *repo); +/** + * Create a new signature by parsing the given buffer, which is + * expected to be in the format "Real Name timestamp tzoffset", + * where `timestamp` is the number of seconds since the Unix epoch and + * `tzoffset` is the timezone offset in `hhmm` format (note the lack + * of a colon separator). + * + * @param out new signature + * @param buf signature string + * @return 0 on success, or an error code + */ +GIT_EXTERN(int) git_signature_from_buffer(git_signature **out, const char *buf); + /** * Create a copy of an existing signature. All internal strings are also * duplicated. -- cgit v1.2.1