git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/4] submodule: rename helper functions to avoid ambiguity

From
Shourya Shukla <shouryashukla.oo@gmail.com>
Date
Jul 2, 2020, 19:24 UTC
Message-ID
<20200702192409.21865-3-shouryashukla.oo@gmail.com>
In-Reply-To
<20200702192409.21865-1-shouryashukla.oo@gmail.com>

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>
---
 diff.c      |  2 +-
 submodule.c | 10 +++++-----
 submodule.h |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/diff.c b/diff.c
index d24aaa3047..4a2c631c37 100644
--- a/diff.c
+++ b/diff.c
@@ -3429,7 +3429,7 @@ static void builtin_diff(const char *name_a,
 	if (o->submodule_format == DIFF_SUBMODULE_LOG &&
 	    (!one->mode || S_ISGITLINK(one->mode)) &&
 	    (!two->mode || S_ISGITLINK(two->mode))) {
-		show_submodule_summary(o, one->path ? one->path : two->path,
+		show_submodule_diff_summary(o, one->path ? one->path : two->path,
 				&one->oid, &two->oid,
 				two->dirty_submodule);
 		return;
diff --git a/submodule.c b/submodule.c
index e2ef5698c8..097902ee67 100644
--- a/submodule.c
+++ b/submodule.c
@@ -438,7 +438,7 @@ void handle_ignore_submodules_arg(struct diff_options *diffopt,
 	 */
 }
 
-static int prepare_submodule_summary(struct rev_info *rev, const char *path,
+static int prepare_submodule_diff_summary(struct rev_info *rev, const char *path,
 		struct commit *left, struct commit *right,
 		struct commit_list *merge_bases)
 {
@@ -459,7 +459,7 @@ static int prepare_submodule_summary(struct rev_info *rev, const char *path,
 	return prepare_revision_walk(rev);
 }
 
-static void print_submodule_summary(struct repository *r, struct rev_info *rev, struct diff_options *o)
+static void print_submodule_diff_summary(struct repository *r, struct rev_info *rev, struct diff_options *o)
 {
 	static const char format[] = "  %m %s";
 	struct strbuf sb = STRBUF_INIT;
@@ -610,7 +610,7 @@ static void show_submodule_header(struct diff_options *o,
 	strbuf_release(&sb);
 }
 
-void show_submodule_summary(struct diff_options *o, const char *path,
+void show_submodule_diff_summary(struct diff_options *o, const char *path,
 		struct object_id *one, struct object_id *two,
 		unsigned dirty_submodule)
 {
@@ -632,12 +632,12 @@ void show_submodule_summary(struct diff_options *o, const char *path,
 		goto out;
 
 	/* Treat revision walker failure the same as missing commits */
-	if (prepare_submodule_summary(&rev, path, left, right, merge_bases)) {
+	if (prepare_submodule_diff_summary(&rev, path, left, right, merge_bases)) {
 		diff_emit_submodule_error(o, "(revision walker failed)\n");
 		goto out;
 	}
 
-	print_submodule_summary(sub, &rev, o);
+	print_submodule_diff_summary(sub, &rev, o);
 
 out:
 	if (merge_bases)
diff --git a/submodule.h b/submodule.h
index 4dad649f94..22db9e1832 100644
--- a/submodule.h
+++ b/submodule.h
@@ -69,7 +69,7 @@ int parse_submodule_update_strategy(const char *value,
 				    struct submodule_update_strategy *dst);
 const char *submodule_strategy_to_string(const struct submodule_update_strategy *s);
 void handle_ignore_submodules_arg(struct diff_options *, const char *);
-void show_submodule_summary(struct diff_options *o, const char *path,
+void show_submodule_diff_summary(struct diff_options *o, const char *path,
 			    struct object_id *one, struct object_id *two,
 			    unsigned dirty_submodule);
 void show_submodule_inline_diff(struct diff_options *o, const char *path,
-- 
2.27.0
Previous: Philip OakleyNext: Shourya Shukla
Message 8 of 21 in “submodule: port 'summary' from Shell to C”
  1. Shourya ShuklaJul 2, 2020
  2. 1/4 submodule: amend extra line feed between callback struct and macroShourya Shukla, Jul 2, 2020
  3. Johannes SchindelinJul 3, 2020
  4. Philip OakleyJul 3, 2020
  5. Shourya ShuklaJul 4, 2020
  6. Đoàn Trần Công DanhJul 4, 2020
  7. Philip OakleyJul 5, 2020
  8. 2/4 submodule: rename helper functions to avoid ambiguityShourya Shukla, Jul 2, 2020
  9. 3/4 diff: change scope of the function count_lines()Shourya Shukla, Jul 2, 2020
  10. Johannes SchindelinJul 3, 2020
  11. Shourya ShuklaJul 4, 2020
  12. Christian CouderJul 4, 2020
  13. 4/4 submodule: port submodule subcommand 'summary' from shell to CShourya Shukla, Jul 2, 2020
  14. Johannes SchindelinJul 3, 2020
  15. Shourya ShuklaJul 5, 2020
  16. Kaartic SivaraamJul 6, 2020
  17. Shourya ShuklaJul 6, 2020
  18. Johannes SchindelinJul 12, 2020
  19. Shourya ShuklaJul 15, 2020
  20. Shourya ShuklaJul 15, 2020
  21. Johannes SchindelinAug 10, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.