Skip to content

Commit 49f9941

Browse files
committed
submodule: git submodule dup has been added.
1 parent be95f68 commit 49f9941

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

include/git2/submodule.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,13 @@ GIT_EXTERN(int) git_submodule_lookup(
223223
git_repository *repo,
224224
const char *name);
225225

226+
/**
227+
* Dup (retain) a submodule
228+
*
229+
* @param submodule Submodule object
230+
*/
231+
GIT_EXTERN(git_submodule *) git_submodule_dup(git_submodule *submodule);
232+
226233
/**
227234
* Release a submodule
228235
*

src/submodule.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,6 +1854,14 @@ static void submodule_release(git_submodule *sm)
18541854
git__free(sm);
18551855
}
18561856

1857+
git_submodule* git_submodule_dup(git_submodule *sm)
1858+
{
1859+
if (!sm)
1860+
return;
1861+
GIT_REFCOUNT_INC(sm);
1862+
return sm;
1863+
}
1864+
18571865
void git_submodule_free(git_submodule *sm)
18581866
{
18591867
if (!sm)

0 commit comments

Comments
 (0)