@@ -57,7 +57,9 @@ struct git_transaction {
5757int git_transaction_config_new (git_transaction * * out , git_config * cfg )
5858{
5959 git_transaction * tx ;
60- assert (out && cfg );
60+
61+ GIT_ASSERT_ARG (out );
62+ GIT_ASSERT_ARG (cfg );
6163
6264 tx = git__calloc (1 , sizeof (git_transaction ));
6365 GIT_ERROR_CHECK_ALLOC (tx );
@@ -74,7 +76,8 @@ int git_transaction_new(git_transaction **out, git_repository *repo)
7476 git_pool pool ;
7577 git_transaction * tx = NULL ;
7678
77- assert (out && repo );
79+ GIT_ASSERT_ARG (out );
80+ GIT_ASSERT_ARG (repo );
7881
7982 if ((error = git_pool_init (& pool , 1 )) < 0 )
8083 goto on_error ;
@@ -109,7 +112,8 @@ int git_transaction_lock_ref(git_transaction *tx, const char *refname)
109112 int error ;
110113 transaction_node * node ;
111114
112- assert (tx && refname );
115+ GIT_ASSERT_ARG (tx );
116+ GIT_ASSERT_ARG (refname );
113117
114118 node = git_pool_mallocz (& tx -> pool , sizeof (transaction_node ));
115119 GIT_ERROR_CHECK_ALLOC (node );
@@ -176,7 +180,9 @@ int git_transaction_set_target(git_transaction *tx, const char *refname, const g
176180 int error ;
177181 transaction_node * node ;
178182
179- assert (tx && refname && target );
183+ GIT_ASSERT_ARG (tx );
184+ GIT_ASSERT_ARG (refname );
185+ GIT_ASSERT_ARG (target );
180186
181187 if ((error = find_locked (& node , tx , refname )) < 0 )
182188 return error ;
@@ -195,7 +201,9 @@ int git_transaction_set_symbolic_target(git_transaction *tx, const char *refname
195201 int error ;
196202 transaction_node * node ;
197203
198- assert (tx && refname && target );
204+ GIT_ASSERT_ARG (tx );
205+ GIT_ASSERT_ARG (refname );
206+ GIT_ASSERT_ARG (target );
199207
200208 if ((error = find_locked (& node , tx , refname )) < 0 )
201209 return error ;
@@ -272,7 +280,9 @@ int git_transaction_set_reflog(git_transaction *tx, const char *refname, const g
272280 int error ;
273281 transaction_node * node ;
274282
275- assert (tx && refname && reflog );
283+ GIT_ASSERT_ARG (tx );
284+ GIT_ASSERT_ARG (refname );
285+ GIT_ASSERT_ARG (reflog );
276286
277287 if ((error = find_locked (& node , tx , refname )) < 0 )
278288 return error ;
@@ -320,7 +330,7 @@ int git_transaction_commit(git_transaction *tx)
320330 transaction_node * node ;
321331 int error = 0 ;
322332
323- assert (tx );
333+ GIT_ASSERT_ARG (tx );
324334
325335 if (tx -> type == TRANSACTION_CONFIG ) {
326336 error = git_config_unlock (tx -> cfg , true);
@@ -355,7 +365,8 @@ void git_transaction_free(git_transaction *tx)
355365 transaction_node * node ;
356366 git_pool pool ;
357367
358- assert (tx );
368+ if (!tx )
369+ return ;
359370
360371 if (tx -> type == TRANSACTION_CONFIG ) {
361372 if (tx -> cfg ) {
0 commit comments