submodule: git submodule dup has been added.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/include/git2/submodule.h b/include/git2/submodule.h
index bedd76d..139a0cb 100644
--- a/include/git2/submodule.h
+++ b/include/git2/submodule.h
@@ -224,6 +224,13 @@ GIT_EXTERN(int) git_submodule_lookup(
const char *name);
/**
+ * Dup (retain) a submodule
+ *
+ * @param submodule Submodule object
+ */
+GIT_EXTERN(git_submodule *) git_submodule_dup(git_submodule *submodule);
+
+/**
* Release a submodule
*
* @param submodule Submodule object
diff --git a/src/submodule.c b/src/submodule.c
index 1486945..0460f47 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -1854,6 +1854,14 @@ static void submodule_release(git_submodule *sm)
git__free(sm);
}
+git_submodule* git_submodule_dup(git_submodule *sm)
+{
+ if (!sm)
+ return;
+ GIT_REFCOUNT_INC(sm);
+ return sm;
+}
+
void git_submodule_free(git_submodule *sm)
{
if (!sm)