All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC/PATCH] revision.c: add --format option for 'git log'
@ 2009-02-21 15:26 Felipe Contreras
  2009-02-22 16:49 ` Junio C Hamano
  0 siblings, 1 reply; 40+ messages in thread
From: Felipe Contreras @ 2009-02-21 15:26 UTC (permalink / raw)
  To: git; +Cc: Felipe Contreras

--format=:foo is a shorthand for --pretty=tformat:foo, otherwise this
new option acts just like --pretty=foo, except it's more intuitive for
users of 'git log'.

As discussed in the mailing list, this is implemented as an undocumented
option. The specifics of the implementation were suggested by Junio C
Hamano.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 revision.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/revision.c b/revision.c
index 286e416..6796e39 100644
--- a/revision.c
+++ b/revision.c
@@ -1147,6 +1147,16 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 	} else if (!prefixcmp(arg, "--pretty=")) {
 		revs->verbose_header = 1;
 		get_commit_format(arg+9, revs);
+	} else if (!prefixcmp(arg, "--format=")) {
+		char *modified = NULL;
+		revs->verbose_header = 1;
+		if (arg[9] == ':') {
+			modified = xmalloc(strlen(arg+9) + 7 + 1);
+			strcpy(modified, "tformat");
+			strcat(modified, arg+9);
+		}
+		get_commit_format(modified ? modified : arg+9, revs);
+		free(modified);
 	} else if (!strcmp(arg, "--graph")) {
 		revs->topo_order = 1;
 		revs->rewrite_parents = 1;
-- 
1.6.1.3

^ permalink raw reply related	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2009-02-27 18:55 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-21 15:26 [RFC/PATCH] revision.c: add --format option for 'git log' Felipe Contreras
2009-02-22 16:49 ` Junio C Hamano
2009-02-22 17:18   ` Felipe Contreras
2009-02-22 17:53     ` Junio C Hamano
2009-02-22 18:06       ` Junio C Hamano
2009-02-22 18:14       ` Felipe Contreras
2009-02-22 18:37         ` Junio C Hamano
2009-02-22 18:55           ` Felipe Contreras
2009-02-23  6:39             ` Junio C Hamano
2009-02-24  0:56               ` Felipe Contreras
2009-02-24  1:03                 ` Felipe Contreras
2009-02-24  1:33                   ` Junio C Hamano
2009-02-24  1:55                     ` Nanako Shiraishi
2009-02-24  8:00                       ` Junio C Hamano
2009-02-24  9:34                         ` Felipe Contreras
2009-02-24  4:06                     ` [PATCH] Add --format that is a synonym to --pretty Nanako Shiraishi
2009-02-24  4:50                       ` Jeff King
2009-02-24  5:33                         ` Junio C Hamano
2009-02-24  5:45                           ` Jeff King
2009-02-24  9:59                             ` [PATCH 0/3] --format, --pretty and --oneline Nanako Shiraishi
2009-02-24  9:59                               ` [PATCH 1/3] Add --format that is a synonym to --pretty Nanako Shiraishi
2009-02-24  9:59                               ` [PATCH 2/3] Give short-hands to --pretty=tformat:%formatstring Nanako Shiraishi
2009-02-24  9:59                               ` [PATCH 3/3] Add --oneline that is a synonym to "--pretty=oneline --abbrev-commit" Nanako Shiraishi
2009-02-24 17:38                                 ` Junio C Hamano
2009-02-24 21:06                                   ` [PATCH] Add tests for git log --pretty, --format and --oneline Felipe Contreras
2009-02-25  9:54                                     ` Junio C Hamano
2009-02-25  9:57                                       ` Jeff King
2009-02-25 10:16                                         ` Junio C Hamano
2009-02-25 10:20                                           ` Jeff King
2009-02-24 11:02                               ` [PATCH] bash completion: add --format= and --oneline options for "git log" Teemu Likonen
2009-02-24 13:33                                 ` [PATCH v2] " Teemu Likonen
2009-02-24 15:39                                   ` Shawn O. Pearce
2009-02-24 15:47                                     ` Teemu Likonen
2009-02-24 15:57                                       ` Shawn O. Pearce
2009-02-24 16:14                                         ` Teemu Likonen
2009-02-27 18:53                                   ` Teemu Likonen
2009-02-24  8:35                     ` [RFC/PATCH] revision.c: add --format option for 'git log' Felipe Contreras
2009-02-22 20:34         ` Linus Torvalds
2009-02-22 22:12           ` Jakub Narebski
2009-02-23  9:55           ` Wincent Colaiuta

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.