@matheusbsbs / matheus-bagliano / commits / 180b154b09
Fork 0

submodule: rename helper functions to avoid ambiguity

The helper functions: show_submodule_summary(), prepare_submodule_summary() and print_submodule_summary() are used by the builtin_diff() function in diff.c to generate a summary of submodules in the context of a diff. Functions with similar names are to be introduced in the upcoming port of submodule's summary subcommand. So, rename the helper functions to '*_diff_submodule_summary()' to avoid ambiguity. Mentored-by: Christian Couder <chriscool@tuxfamily.org> Mentored-by: Kaartic Sivaraam <kaartic.sivaraam@gmail.com> Signed-off-by: Shourya Shukla <shouryashukla.oo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Shourya Shukla committed Aug 13, 2020 at 01:14 UTC 180b154b0900766cf69f79d19432cd04bbcc8a91
3 files changed +7 -7
diff.c
+1 -1
@@ -3429,7 +3429,7 @@ static void builtin_diff(const char *name_a,
3429 if (o->submodule_format == DIFF_SUBMODULE_LOG &&
3430 (!one->mode || S_ISGITLINK(one->mode)) &&
3431 (!two->mode || S_ISGITLINK(two->mode))) {
3432 - show_submodule_summary(o, one->path ? one->path : two->path,
3432 + show_submodule_diff_summary(o, one->path ? one->path : two->path,
3433 &one->oid, &two->oid,
3434 two->dirty_submodule);
3435 return;
submodule.c
+5 -5
@@ -438,7 +438,7 @@ void handle_ignore_submodules_arg(struct diff_options *diffopt,
438 */
439 }
440
441 -static int prepare_submodule_summary(struct rev_info *rev, const char *path,
441 +static int prepare_submodule_diff_summary(struct rev_info *rev, const char *path,
442 struct commit *left, struct commit *right,
443 struct commit_list *merge_bases)
444 {
@@ -459,7 +459,7 @@ static int prepare_submodule_summary(struct rev_info *rev, const char *path,
459 return prepare_revision_walk(rev);
460 }
461
462 -static void print_submodule_summary(struct repository *r, struct rev_info *rev, struct diff_options *o)
462 +static void print_submodule_diff_summary(struct repository *r, struct rev_info *rev, struct diff_options *o)
463 {
464 static const char format[] = " %m %s";
465 struct strbuf sb = STRBUF_INIT;
@@ -610,7 +610,7 @@ output_header:
610 strbuf_release(&sb);
611 }
612
613 -void show_submodule_summary(struct diff_options *o, const char *path,
613 +void show_submodule_diff_summary(struct diff_options *o, const char *path,
614 struct object_id *one, struct object_id *two,
615 unsigned dirty_submodule)
616 {
@@ -632,12 +632,12 @@ void show_submodule_summary(struct diff_options *o, const char *path,
632 goto out;
633
634 /* Treat revision walker failure the same as missing commits */
635 - if (prepare_submodule_summary(&rev, path, left, right, merge_bases)) {
635 + if (prepare_submodule_diff_summary(&rev, path, left, right, merge_bases)) {
636 diff_emit_submodule_error(o, "(revision walker failed)\n");
637 goto out;
638 }
639
640 - print_submodule_summary(sub, &rev, o);
640 + print_submodule_diff_summary(sub, &rev, o);
641
642 out:
643 if (merge_bases)
submodule.h
+1 -1
@@ -69,7 +69,7 @@ int parse_submodule_update_strategy(const char *value,
69 struct submodule_update_strategy *dst);
70 const char *submodule_strategy_to_string(const struct submodule_update_strategy *s);
71 void handle_ignore_submodules_arg(struct diff_options *, const char *);
72 -void show_submodule_summary(struct diff_options *o, const char *path,
72 +void show_submodule_diff_summary(struct diff_options *o, const char *path,
73 struct object_id *one, struct object_id *two,
74 unsigned dirty_submodule);
75 void show_submodule_inline_diff(struct diff_options *o, const char *path,