commit - 5813d178aff670a67346e23851a985a8530a8d33
commit + 095892882c4ccc2f584998552200561f340e060f
blob - ca9b00397c9f4b9743440e020914a5be8ea662d7
blob + 106fa01cdcb16ebcfb3d4274fd2a3f883de11933
--- include/got_error.h
+++ include/got_error.h
#define GOT_ERR_TREE_DUP_ENTRY 58
#define GOT_ERR_DIR_DUP_ENTRY 59
#define GOT_ERR_NOT_WORKTREE 60
+#define GOT_ERR_UUID_VERSION 61
+#define GOT_ERR_UUID_INVALID 62
+#define GOT_ERR_UUID 63
static const struct got_error {
int code;
{ GOT_ERR_TREE_DUP_ENTRY,"duplicate entry in tree object" },
{ GOT_ERR_DIR_DUP_ENTRY,"duplicate entry in directory" },
{ GOT_ERR_NOT_WORKTREE, "no got work tree found" },
+ { GOT_ERR_UUID_VERSION, "bad uuid version" },
+ { GOT_ERR_UUID_INVALID, "uuid invalid" },
+ { GOT_ERR_UUID, "uuid error" },
};
/*
* message set during earlier invocations.
*/
const struct got_error *got_error_not_ref(const char *);
+
+/* Return an error based on a uuid(3) status code. */
+const struct got_error *got_error_uuid(uint32_t);
blob - 72cf6ae7f1505bf4f6059b6384a1f700ea922bbd
blob + 737359cf3aae1b0bca724c568acc3c9b7949928c
--- lib/error.c
+++ lib/error.c
#include <string.h>
#include <sha1.h>
#include <zlib.h>
+#include <uuid.h>
#include "got_error.h"
#include "got_object.h"
return got_error_msg(GOT_ERR_NOT_REF, msg);
}
+
+const struct got_error *
+got_error_uuid(uint32_t uuid_status)
+{
+ switch (uuid_status) {
+ case uuid_s_ok:
+ return NULL;
+ case uuid_s_bad_version:
+ return got_error(GOT_ERR_UUID_VERSION);
+ case uuid_s_invalid_string_uuid:
+ return got_error(GOT_ERR_UUID_INVALID);
+ case uuid_s_no_memory:
+ return got_error_set_errno(ENOMEM);
+ default:
+ return got_error(GOT_ERR_UUID);
+ }
+}