Re: [PATCH v17 03/10] receive-pack: add new proc-receive hook
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 17, 2020, 20:53 UTC
- Message-ID
- <xmqq8sed0zau.fsf@gitster.c.googlers.com>
- In-Reply-To
- <20200815171740.6257-4-worldhello.net@gmail.com>
Jiang Xin <worldhello.net@gmail.com> writes:
> > Suggested-by: Junio C Hamano <gitster@pobox.com>
Did I???? I do not think I deserve any credit here.
> Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Show 8 quoted lines
> +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?
Show 24 quoted lines
> 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 [<options>...]",
> + 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.