@@ -263,20 +263,20 @@ int parse_push_recurse_submodules_arg(const char *opt, const char *arg)
263263 return parse_push_recurse (opt , arg , 1 );
264264}
265265
266- static void warn_multiple_config (const unsigned char * commit_sha1 ,
266+ static void warn_multiple_config (const unsigned char * treeish_name ,
267267 const char * name , const char * option )
268268{
269269 const char * commit_string = "WORKTREE" ;
270- if (commit_sha1 )
271- commit_string = sha1_to_hex (commit_sha1 );
270+ if (treeish_name )
271+ commit_string = sha1_to_hex (treeish_name );
272272 warning ("%s:.gitmodules, multiple configurations found for "
273273 "'submodule.%s.%s'. Skipping second one!" ,
274274 commit_string , name , option );
275275}
276276
277277struct parse_config_parameter {
278278 struct submodule_cache * cache ;
279- const unsigned char * commit_sha1 ;
279+ const unsigned char * treeish_name ;
280280 const unsigned char * gitmodules_sha1 ;
281281 int overwrite ;
282282};
@@ -300,7 +300,7 @@ static int parse_config(const char *var, const char *value, void *data)
300300 if (!value )
301301 ret = config_error_nonbool (var );
302302 else if (!me -> overwrite && submodule -> path )
303- warn_multiple_config (me -> commit_sha1 , submodule -> name ,
303+ warn_multiple_config (me -> treeish_name , submodule -> name ,
304304 "path" );
305305 else {
306306 if (submodule -> path )
@@ -314,7 +314,7 @@ static int parse_config(const char *var, const char *value, void *data)
314314 int die_on_error = is_null_sha1 (me -> gitmodules_sha1 );
315315 if (!me -> overwrite &&
316316 submodule -> fetch_recurse != RECURSE_SUBMODULES_NONE )
317- warn_multiple_config (me -> commit_sha1 , submodule -> name ,
317+ warn_multiple_config (me -> treeish_name , submodule -> name ,
318318 "fetchrecursesubmodules" );
319319 else
320320 submodule -> fetch_recurse = parse_fetch_recurse (
@@ -324,7 +324,7 @@ static int parse_config(const char *var, const char *value, void *data)
324324 if (!value )
325325 ret = config_error_nonbool (var );
326326 else if (!me -> overwrite && submodule -> ignore )
327- warn_multiple_config (me -> commit_sha1 , submodule -> name ,
327+ warn_multiple_config (me -> treeish_name , submodule -> name ,
328328 "ignore" );
329329 else if (strcmp (value , "untracked" ) &&
330330 strcmp (value , "dirty" ) &&
@@ -340,7 +340,7 @@ static int parse_config(const char *var, const char *value, void *data)
340340 if (!value ) {
341341 ret = config_error_nonbool (var );
342342 } else if (!me -> overwrite && submodule -> url ) {
343- warn_multiple_config (me -> commit_sha1 , submodule -> name ,
343+ warn_multiple_config (me -> treeish_name , submodule -> name ,
344344 "url" );
345345 } else {
346346 free ((void * ) submodule -> url );
@@ -351,21 +351,21 @@ static int parse_config(const char *var, const char *value, void *data)
351351 ret = config_error_nonbool (var );
352352 else if (!me -> overwrite &&
353353 submodule -> update_strategy .type != SM_UPDATE_UNSPECIFIED )
354- warn_multiple_config (me -> commit_sha1 , submodule -> name ,
354+ warn_multiple_config (me -> treeish_name , submodule -> name ,
355355 "update" );
356356 else if (parse_submodule_update_strategy (value ,
357357 & submodule -> update_strategy ) < 0 )
358358 die (_ ("invalid value for %s" ), var );
359359 } else if (!strcmp (item .buf , "shallow" )) {
360360 if (!me -> overwrite && submodule -> recommend_shallow != -1 )
361- warn_multiple_config (me -> commit_sha1 , submodule -> name ,
361+ warn_multiple_config (me -> treeish_name , submodule -> name ,
362362 "shallow" );
363363 else
364364 submodule -> recommend_shallow =
365365 git_config_bool (var , value );
366366 } else if (!strcmp (item .buf , "branch" )) {
367367 if (!me -> overwrite && submodule -> branch )
368- warn_multiple_config (me -> commit_sha1 , submodule -> name ,
368+ warn_multiple_config (me -> treeish_name , submodule -> name ,
369369 "branch" );
370370 else {
371371 free ((void * )submodule -> branch );
@@ -379,18 +379,18 @@ static int parse_config(const char *var, const char *value, void *data)
379379 return ret ;
380380}
381381
382- static int gitmodule_sha1_from_commit (const unsigned char * commit_sha1 ,
382+ static int gitmodule_sha1_from_commit (const unsigned char * treeish_name ,
383383 unsigned char * gitmodules_sha1 ,
384384 struct strbuf * rev )
385385{
386386 int ret = 0 ;
387387
388- if (is_null_sha1 (commit_sha1 )) {
388+ if (is_null_sha1 (treeish_name )) {
389389 hashclr (gitmodules_sha1 );
390390 return 1 ;
391391 }
392392
393- strbuf_addf (rev , "%s:.gitmodules" , sha1_to_hex (commit_sha1 ));
393+ strbuf_addf (rev , "%s:.gitmodules" , sha1_to_hex (treeish_name ));
394394 if (get_sha1 (rev -> buf , gitmodules_sha1 ) >= 0 )
395395 ret = 1 ;
396396
@@ -402,7 +402,7 @@ static int gitmodule_sha1_from_commit(const unsigned char *commit_sha1,
402402 * revisions.
403403 */
404404static const struct submodule * config_from (struct submodule_cache * cache ,
405- const unsigned char * commit_sha1 , const char * key ,
405+ const unsigned char * treeish_name , const char * key ,
406406 enum lookup_type lookup_type )
407407{
408408 struct strbuf rev = STRBUF_INIT ;
@@ -418,7 +418,7 @@ static const struct submodule *config_from(struct submodule_cache *cache,
418418 * return the first submodule. Can be used to check whether
419419 * there are any submodules parsed.
420420 */
421- if (!commit_sha1 || !key ) {
421+ if (!treeish_name || !key ) {
422422 struct hashmap_iter iter ;
423423 struct submodule_entry * entry ;
424424
@@ -428,7 +428,7 @@ static const struct submodule *config_from(struct submodule_cache *cache,
428428 return entry -> config ;
429429 }
430430
431- if (!gitmodule_sha1_from_commit (commit_sha1 , sha1 , & rev ))
431+ if (!gitmodule_sha1_from_commit (treeish_name , sha1 , & rev ))
432432 goto out ;
433433
434434 switch (lookup_type ) {
@@ -448,7 +448,7 @@ static const struct submodule *config_from(struct submodule_cache *cache,
448448
449449 /* fill the submodule config into the cache */
450450 parameter .cache = cache ;
451- parameter .commit_sha1 = commit_sha1 ;
451+ parameter .treeish_name = treeish_name ;
452452 parameter .gitmodules_sha1 = sha1 ;
453453 parameter .overwrite = 0 ;
454454 git_config_from_mem (parse_config , CONFIG_ORIGIN_SUBMODULE_BLOB , rev .buf ,
@@ -471,18 +471,6 @@ static const struct submodule *config_from(struct submodule_cache *cache,
471471 return submodule ;
472472}
473473
474- static const struct submodule * config_from_path (struct submodule_cache * cache ,
475- const unsigned char * commit_sha1 , const char * path )
476- {
477- return config_from (cache , commit_sha1 , path , lookup_path );
478- }
479-
480- static const struct submodule * config_from_name (struct submodule_cache * cache ,
481- const unsigned char * commit_sha1 , const char * name )
482- {
483- return config_from (cache , commit_sha1 , name , lookup_name );
484- }
485-
486474static void ensure_cache_init (void )
487475{
488476 if (is_cache_init )
@@ -496,26 +484,26 @@ int parse_submodule_config_option(const char *var, const char *value)
496484{
497485 struct parse_config_parameter parameter ;
498486 parameter .cache = & the_submodule_cache ;
499- parameter .commit_sha1 = NULL ;
487+ parameter .treeish_name = NULL ;
500488 parameter .gitmodules_sha1 = null_sha1 ;
501489 parameter .overwrite = 1 ;
502490
503491 ensure_cache_init ();
504492 return parse_config (var , value , & parameter );
505493}
506494
507- const struct submodule * submodule_from_name (const unsigned char * commit_sha1 ,
495+ const struct submodule * submodule_from_name (const unsigned char * treeish_name ,
508496 const char * name )
509497{
510498 ensure_cache_init ();
511- return config_from_name (& the_submodule_cache , commit_sha1 , name );
499+ return config_from (& the_submodule_cache , treeish_name , name , lookup_name );
512500}
513501
514- const struct submodule * submodule_from_path (const unsigned char * commit_sha1 ,
502+ const struct submodule * submodule_from_path (const unsigned char * treeish_name ,
515503 const char * path )
516504{
517505 ensure_cache_init ();
518- return config_from_path (& the_submodule_cache , commit_sha1 , path );
506+ return config_from (& the_submodule_cache , treeish_name , path , lookup_path );
519507}
520508
521509void submodule_free (void )
0 commit comments