From: Junio C Hamano Date: Mon, 17 Aug 2020 20:53:29 GMT Subject: Re: [PATCH v17 03/10] receive-pack: add new proc-receive hook Message-ID: In-Reply-To: <20200815171740.6257-4-worldhello.net@gmail.com> Jiang Xin writes: > > Suggested-by: Junio C Hamano Did I???? I do not think I deserve any credit here. > Signed-off-by: Jiang Xin > +static struct command *find_command_by_refname(const struct command *list, > + const char *refname) > +{ > + for (; list; list = list->next) > + if (!strcmp(list->ref_name, refname)) > + return (struct command *)list; > + return NULL; > +} Does the last cast really needed, perhaps the caller is adding "const" to its objects where it is not needed, or the variable caller uses to receive the returned value of too loose a type? > diff --git a/t/helper/test-proc-receive.c b/t/helper/test-proc-receive.c > new file mode 100644 > index 0000000000..4f352a7baf > --- /dev/null > +++ b/t/helper/test-proc-receive.c > @@ -0,0 +1,176 @@ > +#include "cache.h" > +#include "connect.h" > +#include "parse-options.h" > +#include "pkt-line.h" > +#include "sigchain.h" > +#include "test-tool.h" > + > +static const char *proc_receive_usage[] = { > + "test-tool proc-receive [...]", > + NULL > +}; > + > +static int die_version = 0; > +static int die_readline = 0; > +static int no_push_options = 0; > +static int use_atomic = 0; > +static int use_push_options = 0; > +static int verbose = 0; Let BSS do its job by omitting " = 0;" and " = NULL;" at the end.