Junio C Hamano [off-list ref] writes:
Miriam Rubio [off-list ref] writes:
quoted
From: Pranit Bauva <redacted>
Reimplement the `bisect_replay` shell function in C and also add
`--bisect-replay` subcommand to `git bisect--helper` to call it from
git-bisect.sh
...
+static int process_replay_line(struct bisect_terms *terms, struct strbuf *line)
+{
+ const char *p = line->buf + strspn(line->buf, " \t");
+
+ if ((!skip_prefix(p, "git bisect", &p) &&
+ !skip_prefix(p, "git-bisect", &p)) || !isspace(*p))
+ return 0;
+ p += strspn(p, " \t");
+
+ char *word_end = (char*)p + strcspn(p, " \t");
+ char *rev = word_end + strspn(word_end, " \t");
Are these lines new in this round?
These break builds with -Werror=declaration-after-statement.
The following fix-up is tentatively queued at the tip of the topic
in tonight's pushout. There might be better way to do what this
function is doing (especially I am skeptical about the way the code
casts const away), so please don't blindly trust it, but at least it
should please the compiler.
(char*) should be spelled (char *), by the way.
Thanks.
diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
index 3b0a6a7d0c..c673f87795 100644
--- a/builtin/bisect--helper.c
+++ b/builtin/bisect--helper.c
@@ -918,14 +918,15 @@ static enum bisect_error bisect_log(void)
static int process_replay_line(struct bisect_terms *terms, struct strbuf *line)
{
const char *p = line->buf + strspn(line->buf, " \t");
+ char *word_end, *rev;
if ((!skip_prefix(p, "git bisect", &p) &&
!skip_prefix(p, "git-bisect", &p)) || !isspace(*p))
return 0;
p += strspn(p, " \t");
- char *word_end = (char*)p + strcspn(p, " \t");
- char *rev = word_end + strspn(word_end, " \t");
+ word_end = (char*)p + strcspn(p, " \t");
+ rev = word_end + strspn(word_end, " \t");
*word_end = '\0'; /* NUL-terminate the word */
get_terms(terms);--
2.30.0-492-gde1138eff7