@@ -257,78 +257,62 @@ static int parse_config(const char *var, const char *value, void *data)
257
257
if (!name_and_item_from_var (var , & name , & item ))
258
258
return 0 ;
259
259
260
- submodule = lookup_or_create_by_name (me -> cache , me -> gitmodules_sha1 ,
261
- name .buf );
260
+ submodule = lookup_or_create_by_name (me -> cache ,
261
+ me -> gitmodules_sha1 ,
262
+ name .buf );
262
263
263
264
if (!strcmp (item .buf , "path" )) {
264
- struct strbuf path = STRBUF_INIT ;
265
- if (!value ) {
265
+ if (!value )
266
266
ret = config_error_nonbool (var );
267
- goto release_return ;
268
- }
269
- if (!me -> overwrite && submodule -> path != NULL ) {
267
+ else if (!me -> overwrite && submodule -> path != NULL )
270
268
warn_multiple_config (me -> commit_sha1 , submodule -> name ,
271
269
"path" );
272
- goto release_return ;
270
+ else {
271
+ if (submodule -> path )
272
+ cache_remove_path (me -> cache , submodule );
273
+ free ((void * ) submodule -> path );
274
+ submodule -> path = xstrdup (value );
275
+ cache_put_path (me -> cache , submodule );
273
276
}
274
-
275
- if (submodule -> path )
276
- cache_remove_path (me -> cache , submodule );
277
- free ((void * ) submodule -> path );
278
- strbuf_addstr (& path , value );
279
- submodule -> path = strbuf_detach (& path , NULL );
280
- cache_put_path (me -> cache , submodule );
281
277
} else if (!strcmp (item .buf , "fetchrecursesubmodules" )) {
282
278
/* when parsing worktree configurations we can die early */
283
279
int die_on_error = is_null_sha1 (me -> gitmodules_sha1 );
284
280
if (!me -> overwrite &&
285
- submodule -> fetch_recurse != RECURSE_SUBMODULES_NONE ) {
281
+ submodule -> fetch_recurse != RECURSE_SUBMODULES_NONE )
286
282
warn_multiple_config (me -> commit_sha1 , submodule -> name ,
287
283
"fetchrecursesubmodules" );
288
- goto release_return ;
289
- }
290
-
291
- submodule -> fetch_recurse = parse_fetch_recurse (var , value ,
284
+ else
285
+ submodule -> fetch_recurse = parse_fetch_recurse (
286
+ var , value ,
292
287
die_on_error );
293
288
} else if (!strcmp (item .buf , "ignore" )) {
294
- struct strbuf ignore = STRBUF_INIT ;
295
- if (!me -> overwrite && submodule -> ignore != NULL ) {
289
+ if (!value )
290
+ ret = config_error_nonbool (var );
291
+ else if (!me -> overwrite && submodule -> ignore != NULL )
296
292
warn_multiple_config (me -> commit_sha1 , submodule -> name ,
297
293
"ignore" );
298
- goto release_return ;
299
- }
300
- if (!value ) {
301
- ret = config_error_nonbool (var );
302
- goto release_return ;
303
- }
304
- if (strcmp (value , "untracked" ) && strcmp (value , "dirty" ) &&
305
- strcmp (value , "all" ) && strcmp (value , "none" )) {
294
+ else if (strcmp (value , "untracked" ) &&
295
+ strcmp (value , "dirty" ) &&
296
+ strcmp (value , "all" ) &&
297
+ strcmp (value , "none" ))
306
298
warning ("Invalid parameter '%s' for config option "
307
299
"'submodule.%s.ignore'" , value , var );
308
- goto release_return ;
300
+ else {
301
+ free ((void * ) submodule -> ignore );
302
+ submodule -> ignore = xstrdup (value );
309
303
}
310
-
311
- free ((void * ) submodule -> ignore );
312
- strbuf_addstr (& ignore , value );
313
- submodule -> ignore = strbuf_detach (& ignore , NULL );
314
304
} else if (!strcmp (item .buf , "url" )) {
315
- struct strbuf url = STRBUF_INIT ;
316
305
if (!value ) {
317
306
ret = config_error_nonbool (var );
318
- goto release_return ;
319
- }
320
- if (!me -> overwrite && submodule -> url != NULL ) {
307
+ } else if (!me -> overwrite && submodule -> url != NULL ) {
321
308
warn_multiple_config (me -> commit_sha1 , submodule -> name ,
322
309
"url" );
323
- goto release_return ;
310
+ } else {
311
+ free ((void * ) submodule -> url );
312
+ submodule -> url = xstrdup (value );
324
313
}
325
-
326
- free ((void * ) submodule -> url );
327
- strbuf_addstr (& url , value );
328
- submodule -> url = strbuf_detach (& url , NULL );
329
314
}
330
315
331
- release_return :
332
316
strbuf_release (& name );
333
317
strbuf_release (& item );
334
318
0 commit comments