Re: [PATCH 10/14] pull: set reflog message
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- May 18, 2015, 19:27 UTC
- Message-ID
- <390e789e8f84122d52185f22e6e798f2@www.dscho.org>
- In-Reply-To
- <1431961571-20370-11-git-send-email-pyokagan@gmail.com>
Hi Paul,
On 2015-05-18 17:06, Paul Tan wrote:
Show 21 quoted lines
> diff --git a/builtin/pull.c b/builtin/pull.c
> index ba2ff01..81e31a1 100644
> --- a/builtin/pull.c
> +++ b/builtin/pull.c
> @@ -212,6 +212,26 @@ static void argv_push_force(struct argv_array *arr)
> }
>
> /**
> + * Sets the GIT_REFLOG_ACTION environment variable to the concatenation of argv
> + */
> +static void set_reflog_message(int argc, const char **argv)
> +{
> + int i;
> + struct strbuf msg = STRBUF_INIT;
> +
> + for (i = 0; i < argc; i++) {
> + strbuf_addstr(&msg, argv[i]);
> + strbuf_addch(&msg, ' ');
> + }
> +
> + strbuf_rtrim(&msg);Since this is not performance critical code, I would be slightly in favor of simplifying thusly:
/* Join the argument list, separated by spaces */ for (i = 0; i < argc; i++) strbuf_addf(&msg, "%s%s", i ? " " : "", argv[i]);
Just a suggestion, Dscho