git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/5] pretty: introduce `get_user_format()`

From
HGHariom Verma via GitGitGadget <gitgitgadget@gmail.com>
Date
Jun 15, 2020, 10:57 UTC
Message-ID
<b568d097159ff9d89bc4fc7c9076d9a8a1e29a1e.1592218662.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.658.git.1592218662.gitgitgadget@gmail.com>
From: Hariom Verma <hariom18599@gmail.com>

In the quest of porting pretty formats to use ref-filters logic, user_format must need to interact with other functions too. So, to get user_format, introduced `const char *get_user_format()`.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Heba Waly <heba.waly@gmail.com>
Signed-off-by: Hariom Verma <hariom18599@gmail.com>
---
 pretty.c | 5 +++++
 pretty.h | 3 +++
 2 files changed, 8 insertions(+)
diff --git a/pretty.c b/pretty.c
index 2a3d46bf42f..3767c144b0a 100644
--- a/pretty.c
+++ b/pretty.c
@@ -2016,3 +2016,8 @@ void pp_commit_easy(enum cmit_fmt fmt, const struct commit *commit,
 	pp.fmt = fmt;
 	pretty_print_commit(&pp, commit, sb);
 }
+
+const char *get_user_format(void)
+{
+	return user_format;
+}
diff --git a/pretty.h b/pretty.h
index 071f2fb8e44..517450f72f8 100644
--- a/pretty.h
+++ b/pretty.h
@@ -139,4 +139,7 @@ const char *format_subject(struct strbuf *sb, const char *msg,
 /* Check if "cmit_fmt" will produce an empty output. */
 int commit_format_is_empty(enum cmit_fmt);
 
+/* Returns user_format */
+const char *get_user_format(void);
+
 #endif /* PRETTY_H */
-- 
gitgitgadget
Previous: Hariom Verma via GitGitGadgetNext: Hariom Verma via GitGitGadget
Message 3 of 6 in “[GSoC][RFC] print commits using ref-filter's logic”
  1. 0/5 [GSoC][RFC] print commits using ref-filter's logicHariom Verma via GitGitGadget, Jun 15, 2020
  2. 2/5 revision: add `use_ref_filter` in struct rev_infoHariom Verma via GitGitGadget, Jun 15, 2020
  3. 3/5 pretty: introduce `get_user_format()`Hariom Verma via GitGitGadget, Jun 15, 2020
  4. 4/5 ref_format: add option to skip `\n` at eolHariom Verma via GitGitGadget, Jun 15, 2020
  5. 1/5 builtin/log: new config log.useRefFilterHariom Verma via GitGitGadget, Jun 15, 2020
  6. 5/5 pretty-lib: print commits using ref-filters logicHariom Verma via GitGitGadget, Jun 15, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.