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

[PATCH v2 02/11] sequencer: rename a few functions

From
Charvi Mendiratta <charvi077@gmail.com>
Date
Feb 8, 2021, 19:25 UTC
Message-ID
<20210208192528.21399-3-charvi077@gmail.com>
In-Reply-To
<20210207181439.1178-1-charvi077@gmail.com>

Rename functions to make them more descriptive and while at it, remove unnecessary 'inline' of the skip_fixupish() function.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Charvi Mendiratta <charvi077@gmail.com>
---
 sequencer.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/sequencer.c b/sequencer.c
index f3928cf45c..abc6d5cdfd 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1744,7 +1744,7 @@ static const char skip_first_commit_msg_str[] = N_("The 1st commit message will
 static const char skip_nth_commit_msg_fmt[] = N_("The commit message #%d will be skipped:");
 static const char combined_commit_msg_fmt[] = N_("This is a combination of %d commits.");
 
-static int check_fixup_flag(enum todo_command command, unsigned flag)
+static int is_fixup_flag(enum todo_command command, unsigned flag)
 {
 	return command == TODO_FIXUP && ((flag & TODO_REPLACE_FIXUP_MSG) ||
 					 (flag & TODO_EDIT_FIXUP_MSG));
@@ -1873,7 +1873,7 @@ static int append_squash_message(struct strbuf *buf, const char *body,
 	strbuf_addstr(buf, body + commented_len);
 
 	/* fixup -C after squash behaves like squash */
-	if (check_fixup_flag(command, flag) && !seen_squash(opts)) {
+	if (is_fixup_flag(command, flag) && !seen_squash(opts)) {
 		/*
 		 * We're replacing the commit message so we need to
 		 * append the Signed-off-by: trailer if the user
@@ -1928,7 +1928,7 @@ static int update_squash_messages(struct repository *r,
 			    opts->current_fixup_count + 2);
 		strbuf_splice(&buf, 0, eol - buf.buf, header.buf, header.len);
 		strbuf_release(&header);
-		if (check_fixup_flag(command, flag) && !seen_squash(opts))
+		if (is_fixup_flag(command, flag) && !seen_squash(opts))
 			update_squash_message_for_fixup(&buf);
 	} else {
 		struct object_id head;
@@ -1951,11 +1951,11 @@ static int update_squash_messages(struct repository *r,
 		strbuf_addf(&buf, "%c ", comment_line_char);
 		strbuf_addf(&buf, _(combined_commit_msg_fmt), 2);
 		strbuf_addf(&buf, "\n%c ", comment_line_char);
-		strbuf_addstr(&buf, check_fixup_flag(command, flag) ?
+		strbuf_addstr(&buf, is_fixup_flag(command, flag) ?
 			      _(skip_first_commit_msg_str) :
 			      _(first_commit_msg_str));
 		strbuf_addstr(&buf, "\n\n");
-		if (check_fixup_flag(command, flag))
+		if (is_fixup_flag(command, flag))
 			strbuf_add_commented_lines(&buf, body, strlen(body));
 		else
 			strbuf_addstr(&buf, body);
@@ -1968,7 +1968,7 @@ static int update_squash_messages(struct repository *r,
 			     oid_to_hex(&commit->object.oid));
 	find_commit_subject(message, &body);
 
-	if (command == TODO_SQUASH || check_fixup_flag(command, flag)) {
+	if (command == TODO_SQUASH || is_fixup_flag(command, flag)) {
 		res = append_squash_message(&buf, body, command, opts, flag);
 	} else if (command == TODO_FIXUP) {
 		strbuf_addf(&buf, "\n%c ", comment_line_char);
@@ -5661,7 +5661,7 @@ static int subject2item_cmp(const void *fndata,
 
 define_commit_slab(commit_todo_item, struct todo_item *);
 
-static inline int skip_fixup_amend_squash(const char *subject, const char **p) {
+static int skip_fixupish(const char *subject, const char **p) {
 	return skip_prefix(subject, "fixup! ", p) ||
 	       skip_prefix(subject, "amend! ", p) ||
 	       skip_prefix(subject, "squash! ", p);
@@ -5725,13 +5725,13 @@ int todo_list_rearrange_squash(struct todo_list *todo_list)
 		format_subject(&buf, subject, " ");
 		subject = subjects[i] = strbuf_detach(&buf, &subject_len);
 		unuse_commit_buffer(item->commit, commit_buffer);
-		if (skip_fixup_amend_squash(subject, &p)) {
+		if (skip_fixupish(subject, &p)) {
 			struct commit *commit2;
 
 			for (;;) {
 				while (isspace(*p))
 					p++;
-				if (!skip_fixup_amend_squash(p, &p))
+				if (!skip_fixupish(p, &p))
 					break;
 			}
 
-- 
2.29.0.rc1
Previous: Charvi MendirattaNext: Charvi Mendiratta
Message 22 of 58 in “[Outreachy] Improve the 'fixup [-C | -c]' in interactive rebase”
  1. 0/7 [Outreachy] Improve the 'fixup [-C | -c]' in interactive rebaseCharvi Mendiratta, Feb 7, 2021
  2. 1/7 sequencer: fixup the datatype of the 'flag' argumentCharvi Mendiratta, Feb 7, 2021
  3. 2/7 sequencer: rename a few functionsCharvi Mendiratta, Feb 7, 2021
  4. 3/7 rebase -i: clarify and fix 'fixup -c' rebase-todo helpCharvi Mendiratta, Feb 7, 2021
  5. Eric SunshineFeb 7, 2021
  6. Charvi MendirattaFeb 8, 2021
  7. 7/7 doc/rebase -i: fix typo in the documentation of 'fixup' commandCharvi Mendiratta, Feb 7, 2021
  8. 5/7 t3437: fix indendation of the here-docCharvi Mendiratta, Feb 7, 2021
  9. Eric SunshineFeb 7, 2021
  10. Charvi MendirattaFeb 8, 2021
  11. Phillip WoodFeb 8, 2021
  12. 4/7 t/lib-rebase: change the implementation of commands with optionsCharvi Mendiratta, Feb 7, 2021
  13. 6/7 t/t3437: update the testsCharvi Mendiratta, Feb 7, 2021
  14. Eric SunshineFeb 7, 2021
  15. Charvi MendirattaFeb 8, 2021
  16. Eric SunshineFeb 7, 2021
  17. Charvi MendirattaFeb 8, 2021
  18. 00/11 [Outreachy] Improve the 'fixup [-C | -c]' in interactive rebaseCharvi Mendiratta, Feb 8, 2021
  19. Junio C HamanoFeb 8, 2021
  20. Charvi MendirattaFeb 9, 2021
  21. 01/11 sequencer: fixup the datatype of the 'flag' argumentCharvi Mendiratta, Feb 8, 2021
  22. 02/11 sequencer: rename a few functionsCharvi Mendiratta, Feb 8, 2021
  23. 03/11 rebase -i: clarify and fix 'fixup -c' rebase-todo helpCharvi Mendiratta, Feb 8, 2021
  24. Junio C HamanoFeb 8, 2021
  25. Charvi MendirattaFeb 9, 2021
  26. Eric SunshineFeb 9, 2021
  27. Junio C HamanoFeb 9, 2021
  28. Eric SunshineFeb 9, 2021
  29. Charvi MendirattaFeb 10, 2021
  30. 04/11 t/lib-rebase: change the implementation of commands with optionsCharvi Mendiratta, Feb 8, 2021
  31. Junio C HamanoFeb 8, 2021
  32. Christian CouderFeb 8, 2021
  33. Charvi MendirattaFeb 9, 2021
  34. 05/11 t/t3437: fix indentation of the here-docCharvi Mendiratta, Feb 8, 2021
  35. 06/11 t/t3437: remove the dependency of 'expected-message' file from testsCharvi Mendiratta, Feb 8, 2021
  36. 07/11 t/t3437: check author date of the fixed up commitCharvi Mendiratta, Feb 8, 2021
  37. 10/11 t/t3437: fixup the test 'multiple fixup -c opens editor once'Charvi Mendiratta, Feb 8, 2021
  38. 08/11 t/t3437: simplify and document the test helpersCharvi Mendiratta, Feb 8, 2021
  39. 09/11 t/t3437: cleanup the 'setup' test and use named commits in the testsCharvi Mendiratta, Feb 8, 2021
  40. Junio C HamanoFeb 8, 2021
  41. Charvi MendirattaFeb 9, 2021
  42. 11/11 doc/rebase -i: fix typo in the documentation of 'fixup' commandCharvi Mendiratta, Feb 8, 2021
  43. 00/11 [Outreachy] Improve the 'fixup [-C | -c]' in interactive rebaseCharvi Mendiratta, Feb 10, 2021
  44. Junio C HamanoFeb 11, 2021
  45. Charvi MendirattaFeb 11, 2021
  46. Junio C HamanoFeb 11, 2021
  47. Charvi MendirattaFeb 12, 2021
  48. 01/11 sequencer: fixup the datatype of the 'flag' argumentCharvi Mendiratta, Feb 10, 2021
  49. 03/11 rebase -i: clarify and fix 'fixup -c' rebase-todo helpCharvi Mendiratta, Feb 10, 2021
  50. 05/11 t/t3437: fixup here-docs in the 'setup' testCharvi Mendiratta, Feb 10, 2021
  51. 04/11 t/lib-rebase: update the documentation of FAKE_LINESCharvi Mendiratta, Feb 10, 2021
  52. 02/11 sequencer: rename a few functionsCharvi Mendiratta, Feb 10, 2021
  53. 06/11 t/t3437: remove the dependency of 'expected-message' file from testsCharvi Mendiratta, Feb 10, 2021
  54. 07/11 t/t3437: check the author date of fixed up commitCharvi Mendiratta, Feb 10, 2021
  55. 08/11 t/t3437: simplify and document the test helpersCharvi Mendiratta, Feb 10, 2021
  56. 09/11 t/t3437: use named commits in the testsCharvi Mendiratta, Feb 10, 2021
  57. 10/11 t/t3437: fixup the test 'multiple fixup -c opens editor once'Charvi Mendiratta, Feb 10, 2021
  58. 11/11 doc/rebase -i: fix typo in the documentation of 'fixup' commandCharvi Mendiratta, Feb 10, 2021

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.