Commit 428f1acf97131614d63c23e632ef6ddee7450c51

Dmitry Lobanov 2021-06-15T17:33:03

submodule: git submodule dup out and source parameters have become mandatory.

diff --git a/include/git2/submodule.h b/include/git2/submodule.h
index 857c62f..29d8bc1 100644
--- a/include/git2/submodule.h
+++ b/include/git2/submodule.h
@@ -227,7 +227,7 @@ GIT_EXTERN(int) git_submodule_lookup(
  * Create an in-memory copy of a submodule. The copy must be explicitly
  * free'd or it will leak.
  *
- * @param out Pointer to store the copy of the submodule. Cannot be NULL.
+ * @param out Pointer to store the copy of the submodule.
  * @param source Original submodule to copy.
  */
 GIT_EXTERN(int) git_submodule_dup(git_submodule **out, git_submodule *source);
diff --git a/src/submodule.c b/src/submodule.c
index ee31bd8..7cbb9fa 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -1857,9 +1857,9 @@ static void submodule_release(git_submodule *sm)
 int git_submodule_dup(git_submodule **out, git_submodule *source)
 {
 	GIT_ASSERT_ARG(out);
+	GIT_ASSERT_ARG(source);
 
-	if (source != NULL)
-		GIT_REFCOUNT_INC(source);
+	GIT_REFCOUNT_INC(source);
 
 	*out = source;
 	return 0;