Re: [PATCH 04/10] am: use run_command_l_opt() for show_patch()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> writes:

> The "git show" invocation added in 66335298a47 (rebase: add
> --show-current-patch, 2018-02-11) is a one-off, and one where we're
> not calling oid_to_hex() twice.

I am not sure what relevance it has being a one-off in justifying
this change.

I agree with the latter half of the explanation, though.  As long as
run_command_l_opt() does not reuse the static oid_to_hex() buffers,
this is safe.

> -	if (!is_null_oid(&state->orig_commit)) {
> -		const char *av[4] = { "show", NULL, "--", NULL };
> -		char *new_oid_str;
> -		int ret;
> -
> -		av[1] = new_oid_str = xstrdup(oid_to_hex(&state->orig_commit));
> -		ret = run_command_v_opt(av, RUN_GIT_CMD);
> -		free(new_oid_str);
> -		return ret;
> -	}
> +	if (!is_null_oid(&state->orig_commit))
> +		return run_command_l_opt(RUN_GIT_CMD, "show",
> +					 oid_to_hex(&state->orig_commit),
> +					 "--", NULL);
>  
>  	switch (sub_mode) {
>  	case SHOW_PATCH_RAW:




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux