]> git.proxmox.com Git - libgit2.git/blobdiff - include/git2/signature.h
New upstream version 1.4.3+dfsg.1
[libgit2.git] / include / git2 / signature.h
index feb1b4073288b1ec0a7f8cd66074582e12346c34..849998e66f7afd2407a9d8d4896a6467ce8e640f 100644 (file)
@@ -30,8 +30,8 @@ GIT_BEGIN_DECL
  * @param out new signature, in case of error NULL
  * @param name name of the person
  * @param email email of the person
- * @param time time when the action happened
- * @param offset timezone offset in minutes for the time
+ * @param time time (in seconds from epoch) when the action happened
+ * @param offset timezone offset (in minutes) for the time
  * @return 0 or an error code
  */
 GIT_EXTERN(int) git_signature_new(git_signature **out, const char *name, const char *email, git_time_t time, int offset);
@@ -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 <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, GIT_EINVALID if the signature is not parseable, 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.