* [PATCH] Improve git-rev-list --header output
@ 2005-06-05 13:25 Petr Baudis
2005-06-05 15:17 ` Linus Torvalds
0 siblings, 1 reply; 2+ messages in thread
From: Petr Baudis @ 2005-06-05 13:25 UTC (permalink / raw)
To: torvalds; +Cc: git
Indent the commit header by four spaces like in the --pretty output;
the commit ID is still shown unaligned. This makes the --header output
actually usable for further processing.
Signed-off-by: Petr Baudis <pasky@ucw.cz>
---
commit 7c99469f9820f41138e1bfe1a0f416fa6b56d09d
tree ea9091df859f279e920ec0f8ca9fdc8d9d307e33
parent 441258d08a4bc12121c998e0aa112c8453eb15fc
author Petr Baudis <pasky@ucw.cz> Sun, 05 Jun 2005 15:24:25 +0200
committer Petr Baudis <xpasky@machine.sinus.cz> Sun, 05 Jun 2005 15:24:25 +0200
rev-list.c | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/rev-list.c b/rev-list.c
--- a/rev-list.c
+++ b/rev-list.c
@@ -35,12 +35,34 @@ static void show_commit(struct commit *c
putchar('\n');
if (verbose_header) {
const char *buf = commit->buffer;
+ static char pretty_header[16384];
if (pretty_print) {
- static char pretty_header[16384];
pretty_print_commit(commit->buffer, ~0, pretty_header, sizeof(pretty_header));
buf = pretty_header;
+ } else {
+ /* Indent the commit contents by four chars */
+ char *buf2 = pretty_header;
+ char *eol;
+ do {
+ int len = -1;
+
+ eol = strchr(buf, '\n');
+ if (eol || *buf) {
+ strcpy(buf2, " ");
+ buf2 += 4;
+ }
+ if (eol) {
+ eol++;
+ len = eol - buf;
+ strncpy(buf2, buf, len);
+ buf2 += len;
+ buf = eol;
+ } else {
+ strcpy(buf2, buf);
+ }
+ } while (eol);
}
- printf("%s%c", buf, hdr_termination);
+ printf("%s%c", pretty_header, hdr_termination);
}
}
|
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Improve git-rev-list --header output
2005-06-05 13:25 [PATCH] Improve git-rev-list --header output Petr Baudis
@ 2005-06-05 15:17 ` Linus Torvalds
0 siblings, 0 replies; 2+ messages in thread
From: Linus Torvalds @ 2005-06-05 15:17 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
On Sun, 5 Jun 2005, Petr Baudis wrote:
>
> Indent the commit header by four spaces like in the --pretty output;
> the commit ID is still shown unaligned. This makes the --header output
> actually usable for further processing.
I'm actually going to do a few different "header formats", and have
pretty_print_commit() able to switch between them. IOW, this would count
as just one form of pretty-printing.
I want to have the "dense" format, which has only the author and the top
line(s) of the description (stop at the first empty line), and a "raw"
format, which has all the parent information etc (ie this one).
Linus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-06-05 15:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-05 13:25 [PATCH] Improve git-rev-list --header output Petr Baudis
2005-06-05 15:17 ` Linus Torvalds
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.