summaryrefslogtreecommitdiff
path: root/include/git2/signature.h
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-04-28 12:47:14 -0400
committerEdward Thomson <ethomson@github.com>2016-04-28 12:47:14 -0400
commitd383c39b3bc9a2bd5e68882db9a12e64ccd262a4 (patch)
tree33f21286bf1148c10cbdde2b289e5e5bbc421885 /include/git2/signature.h
parent88284dfb7905c5990babb4238b7cd30bdf823500 (diff)
downloadlibgit2-ethomson/signature_from_buffer.tar.gz
Introduce `git_signature_from_buffer`ethomson/signature_from_buffer
Allow users to construct a signature from the type of signature lines that actually appear in commits.
Diffstat (limited to 'include/git2/signature.h')
-rw-r--r--include/git2/signature.h13
1 files changed, 13 insertions, 0 deletions
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
@@ -63,6 +63,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 <email> 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.
*