Skip to content

convert various shell functions in git-bisect to C

Pranit Bauva git 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest6 patches 2 repliesIn review
  2. v36 patches 0 repliesSuperseded
  3. v26 patches 21 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches7 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6bisect--helper: `bisect_clean_state` shell function in Cbuiltin/bisect--helper.c git-bisect.sh+57 -240 replies
2/6t6030: explicitly test for bisection cleanupt/t6030-bisect-porcelain.sh+17 -01 reply
3/6wrapper: move is_empty_file() and rename it as is_empty_or_missing_file()builtin/am.c cache.h wrapper.c+18 -180 replies
4/6bisect--helper: `bisect_reset` shell function in Cbuiltin/bisect--helper.c git-bisect.sh+48 -270 replies
5/6bisect--helper: `is_expected_rev` & `check_expected_revs` shell function in Cbuiltin/bisect--helper.c git-bisect.sh+34 -190 replies
6/6bisect--helper: `bisect_write` shell function in Cbuiltin/bisect--helper.c git-bisect.sh+94 -280 replies

Reviews trailers per patch

None of the 6 patches has a Reviewed-by or Acked-by.

PatchLars SchneiderChristian CouderEric Sunshine
1/6Mentored-by Mentored-by
2/6Mentored-by Mentored-by
3/6Mentored-by Mentored-by
4/6Mentored-by Mentored-by
5/6Mentored-by Mentored-by Helped-by
6/6Mentored-by Mentored-by

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v4 thread

Cover letter [PATCH v4 0/6] convert various shell functions in git-bisect to C

Some minor nits. Previous version can be found here[1].

[1]: http://thread.gmane.org/gmane.comp.version-control.git/298263

The inter-diff is :

builtin/bisect--helper.c +15 -17
index e946ba9..c2f3cee 100644
@@ -31,18 +31,16 @@ struct bisect_terms {
 	struct strbuf term_bad;
 };
 
-static int bisect_terms_init(struct bisect_terms *term)
+static void bisect_terms_init(struct bisect_terms *terms)
 {
-	strbuf_init(&term->term_good, 0);
-	strbuf_init(&term->term_bad, 0);
-	return 0;
+	strbuf_init(&terms->term_good, 0);
+	strbuf_init(&terms->term_bad, 0);
 }
 
-static int bisect_terms_release(struct bisect_terms *term)
+static void bisect_terms_release(struct bisect_terms *terms)
 {
-	strbuf_release(&term->term_good);
-	strbuf_release(&term->term_good);
-	return 0;
+	strbuf_release(&terms->term_good);
+	strbuf_release(&terms->term_bad);
 }
 
 /*
@@ -209,7 +207,7 @@ static int check_expected_revs(const char **revs, int rev_nr)
 }
 
 static int bisect_write(const char *state, const char *rev,
-			const struct bisect_terms *term, int nolog)
+			const struct bisect_terms *terms, int nolog)
 {
 	struct strbuf tag = STRBUF_INIT;
 	struct strbuf commit_name = STRBUF_INIT;
@@ -218,9 +216,9 @@ static int bisect_write(const char *state, const char *rev,
 	struct pretty_print_context pp = {0};
 	FILE *fp;
 
-	if (!strcmp(state, term->term_bad.buf))
+	if (!strcmp(state, terms->term_bad.buf))
 		strbuf_addf(&tag, "refs/bisect/%s", state);
-	else if(one_of(state, term->term_good.buf, "skip", NULL))
+	else if(one_of(state, terms->term_good.buf, "skip", NULL))
 		strbuf_addf(&tag, "refs/bisect/%s-%s", state, rev);
 	else
 		return error(_("Bad bisect_write argument: %s"), state);
@@ -282,8 +280,8 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
 			 N_("update BISECT_HEAD instead of checking out the current commit")),
 		OPT_END()
 	};
-	struct bisect_terms state;
-	bisect_terms_init(&state);
+	struct bisect_terms terms;
+	bisect_terms_init(&terms);
 
 	argc = parse_options(argc, argv, prefix, options,
 			     git_bisect_helper_usage, 0);
@@ -317,13 +315,13 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
 		if (argc != 4 && argc != 5)
 			die(_("--bisect-write requires either 4 or 5 arguments"));
 		nolog = (argc == 5) && !strcmp(argv[4], "nolog");
-		strbuf_addstr(&state.term_good, argv[2]);
-		strbuf_addstr(&state.term_bad, argv[3]);
-		res = bisect_write(argv[0], argv[1], &state, nolog);
+		strbuf_addstr(&terms.term_good, argv[2]);
+		strbuf_addstr(&terms.term_bad, argv[3]);
+		res = bisect_write(argv[0], argv[1], &terms, nolog);
 		break;
 	default:
 		die("BUG: unknown subcommand '%d'", cmdmode);
 	}
-	bisect_terms_release(&state);
+	bisect_terms_release(&terms);
 	return res;
 }

Pranit Bauva (6):
bisect--helper: bisect_clean_state shell function in C
t6030: explicitly test for bisection cleanup
wrapper: move is_empty_file() and rename it as
is_empty_or_missing_file()
bisect--helper: bisect_reset shell function in C
bisect--helper: is_expected_rev & check_expected_revs shell
function in C
bisect--helper: bisect_write shell function in C

 builtin/am.c                |  20 +---
 builtin/bisect--helper.c    | 220 +++++++++++++++++++++++++++++++++++++++++++-
 cache.h                     |   3 +
 git-bisect.sh               |  97 ++-----------------
 t/t6030-bisect-porcelain.sh |  17 ++++
 wrapper.c                   |  13 +++
 6 files changed, 261 insertions(+), 109 deletions(-)
Signature · 1 line
2.9.0