Commit bf1616d1dd1768efd5bafe4a683a3a45d3c1a33b

Dmitry Lobanov 2021-05-26T15:32:05

submodule: git submodule dup implementation has been reverted. Assert has been added.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/src/submodule.c b/src/submodule.c
index 598a24a..ee31bd8 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -1856,7 +1856,13 @@ static void submodule_release(git_submodule *sm)
 
 int git_submodule_dup(git_submodule **out, git_submodule *source)
 {
-	return git_object_dup((git_object **)out, (git_object *)source);
+	GIT_ASSERT_ARG(out);
+
+	if (source != NULL)
+		GIT_REFCOUNT_INC(source);
+
+	*out = source;
+	return 0;
 }
 
 void git_submodule_free(git_submodule *sm)