Re: [PATCH v4 2/3] builtin/commit.c: refactor --trailer logic

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

 



On Tue, Apr 30, 2024 at 02:41:50PM +0000, John Passaro via GitGitGadget wrote:
> From: John Passaro <john.a.passaro@xxxxxxxxx>
[snip]
> diff --git a/trailer.c b/trailer.c
> index c72ae687099..ae0597d919e 100644
> --- a/trailer.c
> +++ b/trailer.c
> @@ -1170,3 +1170,14 @@ void trailer_iterator_release(struct trailer_iterator *iter)
>  	strbuf_release(&iter->val);
>  	strbuf_release(&iter->key);
>  }
> +
> +int amend_file_with_trailers(const char *path, const struct strvec *trailer_args) {

Nit: the opening brace should go on the next line.

Other than that this patch looks good to me.

Patrick

> +	struct child_process run_trailer = CHILD_PROCESS_INIT;
> +
> +	run_trailer.git_cmd = 1;
> +	strvec_pushl(&run_trailer.args, "interpret-trailers",
> +		     "--in-place", "--no-divider",
> +		     path, NULL);
> +	strvec_pushv(&run_trailer.args, trailer_args->v);
> +	return run_command(&run_trailer);
> +}
> diff --git a/trailer.h b/trailer.h
> index 9f42aa75994..c364405267a 100644
> --- a/trailer.h
> +++ b/trailer.h
> @@ -4,6 +4,8 @@
>  #include "list.h"
>  #include "strbuf.h"
>  
> +struct strvec;
> +
>  enum trailer_where {
>  	WHERE_DEFAULT,
>  	WHERE_END,
> @@ -158,4 +160,11 @@ int trailer_iterator_advance(struct trailer_iterator *iter);
>   */
>  void trailer_iterator_release(struct trailer_iterator *iter);
>  
> +/*
> + * Augment a file to add trailers to it by running git-interpret-trailers.
> + * This calls run_command() and its return value is the same (i.e. 0 for
> + * success, various non-zero for other errors). See run-command.h.
> + */
> +int amend_file_with_trailers(const char *path, const struct strvec *trailer_args);
> +
>  #endif /* TRAILER_H */
> -- 
> gitgitgadget
> 

Attachment: signature.asc
Description: PGP signature


[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