git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [git pull] core/softirq for v2.6.27
       [not found]     ` <20080714094422.e7ae255a.akpm@linux-foundation.org>
@ 2008-07-14 17:11       ` Linus Torvalds
  2008-07-14 17:23         ` Linus Torvalds
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2008-07-14 17:11 UTC (permalink / raw)
  To: Andrew Morton, Junio C Hamano
  Cc: Ingo Molnar, Git Mailing List, Thomas Gleixner



On Mon, 14 Jul 2008, Andrew Morton wrote:
> 
> This was a git-shortlog feature request ;)

Heh. You should cc git or Junio if so.

The way shortlog is done (very different from regular logs, due to the 
whole organize-by-name etc thing) that is sadly pretty ugly to do: we 
don't support the pretty-formats etc. And the way things are done, adding 
support for the generic "--pretty=xyz" (including custom formats) would be 
pretty painful.

So it would have to be a total special-case.

Junio, git people - what Andrew is asking for is for git shortlog to show 
the commit ID (in shortened form) at the end:

> > It would be nice if these short-form summaries were to include the
> > commit IDs.  eg:
> > 
> > Carlos R. Mafra (1):
> >       Remove argument from open_softirq which is always NULL (962cf36)

and I do think it would be nice. I've had some other things I would find 
shortlog format additions useful for (size of patch etc), so if it could 
be somehow generalized that would be wonderful.

As it is, that is one ugly function that only takes the one-liner thing - 
at least partly because of how it traditionally worked (as a a filter over 
the log messages, rather than as a "git shortlog xyz..abc" kind of 
stand-alone thing).

		Linus

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

* Re: [git pull] core/softirq for v2.6.27
  2008-07-14 17:11       ` [git pull] core/softirq for v2.6.27 Linus Torvalds
@ 2008-07-14 17:23         ` Linus Torvalds
  2008-07-14 17:46           ` Johannes Schindelin
  2008-07-14 17:46           ` [git pull] core/softirq for v2.6.27 Linus Torvalds
  0 siblings, 2 replies; 5+ messages in thread
From: Linus Torvalds @ 2008-07-14 17:23 UTC (permalink / raw)
  To: Andrew Morton, Junio C Hamano
  Cc: Ingo Molnar, Git Mailing List, Thomas Gleixner



On Mon, 14 Jul 2008, Linus Torvalds wrote:
> 
> As it is, that is one ugly function that only takes the one-liner thing - 
> at least partly because of how it traditionally worked (as a a filter over 
> the log messages, rather than as a "git shortlog xyz..abc" kind of 
> stand-alone thing).

Heh. I guess you _could_ use the filter capability here (but it will 
sometimes truncate the line, so..)

Some really ugly scripting like this will do it:

	#!/bin/sh
	git log --pretty='format:commit %H
	Author: %an <%ae>
	
	  %s (%h)
	' $@ | git shortlog

where we use the regular "git log" with a user-supplied format to generate 
a log with the subject line and the shortened hash appended (the "%s (%h)" 
part) and then we use "git shortlog" as a filter to sort things together 
by author etc.

There is absolutely _nothing_ that git won't do with a little bit of 
scripting, but I do have to admit that this one isn't a wonderfully 
beautiful script ;)

		Linus

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

* Re: [git pull] core/softirq for v2.6.27
  2008-07-14 17:23         ` Linus Torvalds
@ 2008-07-14 17:46           ` Johannes Schindelin
  2008-07-14 18:08             ` [PATCH] shortlog: support --pretty=format: option Johannes Schindelin
  2008-07-14 17:46           ` [git pull] core/softirq for v2.6.27 Linus Torvalds
  1 sibling, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2008-07-14 17:46 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Andrew Morton, Junio C Hamano, Ingo Molnar, Git Mailing List,
	Thomas Gleixner

Hi,

On Mon, 14 Jul 2008, Linus Torvalds wrote:

> 	git log --pretty='format:commit %H
> 	Author: %an <%ae>
> 	
> 	  %s (%h)
> 	' $@ | git shortlog

Surely you meant

 	git log --pretty='format:commit %H%nAuthor: %an <%ae>%n%n    %s (%h)' \
		$@ | git shortlog

Note that I do not think it would be all that hard to teach shortlog the 
--pretty option.

Ciao,
Dscho

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

* Re: [git pull] core/softirq for v2.6.27
  2008-07-14 17:23         ` Linus Torvalds
  2008-07-14 17:46           ` Johannes Schindelin
@ 2008-07-14 17:46           ` Linus Torvalds
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Torvalds @ 2008-07-14 17:46 UTC (permalink / raw)
  To: Andrew Morton, Junio C Hamano
  Cc: Ingo Molnar, Git Mailing List, Thomas Gleixner



On Mon, 14 Jul 2008, Linus Torvalds wrote:
> 
> Some really ugly scripting like this will do it:
> 
> 	#!/bin/sh
> 	git log --pretty='format:commit %H
> 	Author: %an <%ae>

Side note: you can make it a one-liner with '%n' (not \n') if you want, ie

	#!/bin/sh
	git log --pretty='format:commit %H%nAuthor: %an <%ae>%n%n %s (%h)%n' $@ | git shortlog

if you want to make it look even more like line noise.

And if you want to be _really_ fancy, you can even make it a git 
alias. Just add somethign like this to your ~/.gitconfig file:

	[alias]
		mylog=!GIT_PAGER='git --no-pager shortlog' git log --pretty='format:commit %H%nAuthor: %an <%ae>%n%n %s (%h)%n'

which is the _real_ git-mans way to do it.

It does the "shortlog" output by using "git shortlog" as a pager, but then 
to avoid recursion, we have to turn off paging of shortlog output itself. 
Heh. And the reason to do that is that the arguments always go to the end, 
so since we want to give the args to "git log", we can't put the pipe at 
the end.

I will have to go wash up after writing the above.

		Linus

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

* [PATCH] shortlog: support --pretty=format: option
  2008-07-14 17:46           ` Johannes Schindelin
@ 2008-07-14 18:08             ` Johannes Schindelin
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Schindelin @ 2008-07-14 18:08 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Andrew Morton, Junio C Hamano, Ingo Molnar, Git Mailing List,
	Thomas Gleixner


With this patch, the user can override the default setting, to print
the commit messages using a user format instead of the onelines of the
commits.  Example:

	$ git shortlog --pretty='format:%s (%h)' <commit>..

Note that shortlog will only respect a user format setting, as the other
formats do not make much sense.

Wished for by Andrew Morton.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---

	On Mon, 14 Jul 2008, Johannes Schindelin wrote:

	> Note that I do not think it would be all that hard to teach 
	> shortlog the --pretty option.

	Well...

 builtin-shortlog.c |   11 +++++++++++
 shortlog.h         |    1 +
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index 0136202..f8bcbfc 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -154,6 +154,15 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)
 	if (!author)
 		die("Missing author: %s",
 		    sha1_to_hex(commit->object.sha1));
+	if (log->user_format) {
+		struct strbuf buf = STRBUF_INIT;
+
+		pretty_print_commit(CMIT_FMT_USERFORMAT, commit, &buf,
+			DEFAULT_ABBREV, "", "", DATE_NORMAL, 0);
+		insert_one_record(log, author, buf.buf);
+		strbuf_release(&buf);
+		return;
+	}
 	if (*buffer)
 		buffer++;
 	insert_one_record(log, author, !*buffer ? "<none>" : buffer);
@@ -271,6 +280,8 @@ parse_done:
 		usage_with_options(shortlog_usage, options);
 	}
 
+	log.user_format = rev.commit_format == CMIT_FMT_USERFORMAT;
+
 	/* assume HEAD if from a tty */
 	if (!nongit && !rev.pending.nr && isatty(0))
 		add_head_to_pending(&rev);
diff --git a/shortlog.h b/shortlog.h
index 31ff491..6608ee8 100644
--- a/shortlog.h
+++ b/shortlog.h
@@ -11,6 +11,7 @@ struct shortlog {
 	int wrap;
 	int in1;
 	int in2;
+	int user_format;
 
 	char *common_repo_prefix;
 	int email;
-- 
1.5.6.2.511.ge432a

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

end of thread, other threads:[~2008-07-14 18:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20080714144243.GA21079@elte.hu>
     [not found] ` <20080714092215.0efd7fa3.akpm@linux-foundation.org>
     [not found]   ` <20080714163141.GA21068@elte.hu>
     [not found]     ` <20080714094422.e7ae255a.akpm@linux-foundation.org>
2008-07-14 17:11       ` [git pull] core/softirq for v2.6.27 Linus Torvalds
2008-07-14 17:23         ` Linus Torvalds
2008-07-14 17:46           ` Johannes Schindelin
2008-07-14 18:08             ` [PATCH] shortlog: support --pretty=format: option Johannes Schindelin
2008-07-14 17:46           ` [git pull] core/softirq for v2.6.27 Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).