summaryrefslogtreecommitdiff
path: root/src/oidarray.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-07-18 16:00:21 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-07-27 17:17:22 +0200
commit7db0e6ee48fd68009a7e78cbcbca125d6ce9008d (patch)
treec8d053d8dd5eccf98811ab80a2cc6c6be44a57e7 /src/oidarray.c
parent091165c53b2bcd5d41fb71d43ed5a23a3d96bf5d (diff)
downloadlibgit2-cmn/oidarray.tar.gz
merge: expose multiple merge basescmn/oidarray
We always calculate multiple merge bases, but up to now we had only exposed the "best" merge base. Introduce git_oidarray which analogously to git_strarray lets us return multiple ids.
Diffstat (limited to 'src/oidarray.c')
-rw-r--r--src/oidarray.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/oidarray.c b/src/oidarray.c
new file mode 100644
index 000000000..1d51a2958
--- /dev/null
+++ b/src/oidarray.c
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+#include "git2/oidarray.h"
+#include "oidarray.h"
+#include "array.h"
+
+void git_oidarray_free(git_oidarray *arr)
+{
+ git__free(arr->ids);
+}
+
+void git_oidarray__from_array(git_oidarray *arr, git_array_oid_t *array)
+{
+ arr->count = array->size;
+ arr->ids = array->ptr;
+}