aboutsummaryrefslogtreecommitdiffstats
path: root/trailer.h
diff options
context:
space:
mode:
authorJohn Passaro <john.a.passaro@gmail.com>2024-05-05 18:49:09 +0000
committerJunio C Hamano <gitster@pobox.com>2024-05-07 10:06:03 -0700
commit4a8618785e3df20287d4c18707118d34581a298b (patch)
tree965102e28480df653b4311919178f9a440f284d2 /trailer.h
parent56740f9910218a03374b5e410b3a2d204d7c33ed (diff)
downloadgit-4a8618785e3df20287d4c18707118d34581a298b.tar.gz
builtin/commit: refactor --trailer logic
git-commit adds user trailers to the commit message by passing its `--trailer` arguments to a child process running `git-interpret-trailers --in-place`. This logic is broadly useful, not just for git-commit but for other commands constructing message bodies (e.g. git-tag). Let's move this logic from git-commit to a new function in the trailer API, so that it can be re-used in other commands. Helped-by: Patrick Steinhardt <ps@pks.im> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: John Passaro <john.a.passaro@gmail.com> Acked-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'trailer.h')
-rw-r--r--trailer.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/trailer.h b/trailer.h
index 9f42aa7599..c364405267 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 */