* [RFC/PATCH] pretty.c: %S format specifier for source ref
@ 2010-06-14 14:50 Michael J Gruber
0 siblings, 0 replies; only message in thread
From: Michael J Gruber @ 2010-06-14 14:50 UTC (permalink / raw)
To: git
Currently, there is no way to combine --source with a format string for
log and friends.
Introduce a %S format specifier which outputs the source ref if --source
is given also. This is analogous to specfiers like %gs which are empty
unless used with -g.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
Notes:
I'm not sure whether it's worth introducing pretty_ctx.show_source to
keep track of the use of --source. commit->util is possibly used by
other codepaths also. Even without this patch, --cherry-pick --source
does not work (in the sense that there is an empty source output) because
of this.
RFC obviously also so that I don't have to write doc and tests just yet :)
pretty.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/pretty.c b/pretty.c
index 8b18efd..146320f 100644
--- a/pretty.c
+++ b/pretty.c
@@ -867,6 +867,10 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder,
case 'd':
format_decoration(sb, commit);
return 1;
+ case 'S':
+ if (/* revs->show_source && */commit->util)
+ strbuf_addstr(sb, (char *) commit->util);
+ return 1;
case 'g': /* reflog info */
switch(placeholder[1]) {
case 'd': /* reflog selector */
--
1.7.1.511.gfbed4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-06-14 14:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-14 14:50 [RFC/PATCH] pretty.c: %S format specifier for source ref Michael J Gruber
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.