Reimplement `is_expected_rev` shell function in C. This will further be called from `check_expected_revs` function. This is a quite small function thus subcommand facility is redundant. Mentored-by: Lars Schneider <larsxschneider@xxxxxxxxx> Mentored-by: Christian Couder <chriscool@xxxxxxxxxxxxx> Signed-off-by: Pranit Bauva <pranit.bauva@xxxxxxxxx> --- This applies on the previous patches. builtin/bisect--helper.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 4153e8a..06bc9b8 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -160,6 +160,20 @@ int bisect_reset(const char *commit) return bisect_clean_state(); } +static int is_expected_rev(const char *expected_hex) +{ + struct strbuf actual_hex = STRBUF_INIT; + + if (!file_exists(git_path_bisect_expected_rev())) + return 0; + + if (!strbuf_read_file(&actual_hex, git_path_bisect_expected_rev(), 0)) + return 0; + + strbuf_trim(&actual_hex); + return !strcmp(actual_hex.buf, expected_hex); +} + int cmd_bisect__helper(int argc, const char **argv, const char *prefix) { enum { -- 2.8.3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html