On Sat, Apr 21, 2018 at 5:48 AM, Johannes Schindelin <johannes.schindelin@xxxxxx> wrote: > This option is intended to help with the transition away from the > now-deprecated graft file. > > Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> > --- > diff --git a/builtin/replace.c b/builtin/replace.c > @@ -454,6 +455,38 @@ static int create_graft(int argc, const char **argv, int force) > +static int convert_graft_file(int force) > +{ > + const char *graft_file = get_graft_file(); > + FILE *fp = fopen_or_warn(graft_file, "r"); > + struct strbuf buf = STRBUF_INIT, err = STRBUF_INIT; > + struct argv_array args = ARGV_ARRAY_INIT; > + > + if (!fp) > + return -1; > + > + while (strbuf_getline(&buf, fp) != EOF) { > + if (*buf.buf == '#') > + continue; > + > + argv_array_split(&args, buf.buf); > + if (args.argc && create_graft(args.argc, args.argv, force)) > + strbuf_addf(&err, "\n\t%s", buf.buf); > + argv_array_clear(&args); > + } > + > + strbuf_release(&buf); > + argv_array_clear(&args); This argv_array_clear() is redundant, isn't it? > + if (!err.len) > + return unlink_or_warn(graft_file); > + > + warning(_("could not convert the following graft(s):\n%s"), err.buf); > + strbuf_release(&err); > + > + return -1; > +}