2008-02-25 23:24:14 +00:00
|
|
|
#ifndef SHORTLOG_H
|
|
|
|
#define SHORTLOG_H
|
|
|
|
|
2008-07-21 18:03:49 +00:00
|
|
|
#include "string-list.h"
|
2022-10-24 18:55:30 +00:00
|
|
|
#include "date.h"
|
2008-02-25 23:24:14 +00:00
|
|
|
|
2018-08-15 17:54:05 +00:00
|
|
|
struct commit;
|
|
|
|
|
2008-02-25 23:24:14 +00:00
|
|
|
struct shortlog {
|
2008-07-21 18:03:49 +00:00
|
|
|
struct string_list list;
|
2008-02-25 23:24:14 +00:00
|
|
|
int summary;
|
|
|
|
int wrap_lines;
|
|
|
|
int sort_by_number;
|
|
|
|
int wrap;
|
|
|
|
int in1;
|
|
|
|
int in2;
|
2008-07-14 18:08:52 +00:00
|
|
|
int user_format;
|
2010-05-04 03:18:57 +00:00
|
|
|
int abbrev;
|
2022-10-24 18:55:30 +00:00
|
|
|
struct date_mode date_mode;
|
2020-09-27 08:39:59 +00:00
|
|
|
|
|
|
|
enum {
|
shortlog: allow multiple groups to be specified
Now that shortlog supports reading from trailers, it can be useful to
combine counts from multiple trailers, or between trailers and authors.
This can be done manually by post-processing the output from multiple
runs, but it's non-trivial to make sure that each name/commit pair is
counted only once.
This patch teaches shortlog to accept multiple --group options on the
command line, and pull data from all of them. That makes it possible to
run:
git shortlog -ns --group=author --group=trailer:co-authored-by
to get a shortlog that counts authors and co-authors equally.
The implementation is mostly straightforward. The "group" enum becomes a
bitfield, and the trailer key becomes a list. I didn't bother
implementing the multi-group semantics for reading from stdin. It would
be possible to do, but the existing matching code makes it awkward, and
I doubt anybody cares.
The duplicate suppression we used for trailers now covers authors and
committers as well (though in non-trailer single-group mode we can skip
the hash insertion and lookup, since we only see one value per commit).
There is one subtlety: we now care about the case when no group bit is
set (in which case we default to showing the author). The caller in
builtin/log.c needs to be adapted to ask explicitly for authors, rather
than relying on shortlog_init(). It would be possible with some
gymnastics to make this keep working as-is, but it's not worth it for a
single caller.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-27 08:40:15 +00:00
|
|
|
SHORTLOG_GROUP_AUTHOR = (1 << 0),
|
|
|
|
SHORTLOG_GROUP_COMMITTER = (1 << 1),
|
|
|
|
SHORTLOG_GROUP_TRAILER = (1 << 2),
|
2022-10-24 18:55:39 +00:00
|
|
|
SHORTLOG_GROUP_FORMAT = (1 << 3),
|
shortlog: allow multiple groups to be specified
Now that shortlog supports reading from trailers, it can be useful to
combine counts from multiple trailers, or between trailers and authors.
This can be done manually by post-processing the output from multiple
runs, but it's non-trivial to make sure that each name/commit pair is
counted only once.
This patch teaches shortlog to accept multiple --group options on the
command line, and pull data from all of them. That makes it possible to
run:
git shortlog -ns --group=author --group=trailer:co-authored-by
to get a shortlog that counts authors and co-authors equally.
The implementation is mostly straightforward. The "group" enum becomes a
bitfield, and the trailer key becomes a list. I didn't bother
implementing the multi-group semantics for reading from stdin. It would
be possible to do, but the existing matching code makes it awkward, and
I doubt anybody cares.
The duplicate suppression we used for trailers now covers authors and
committers as well (though in non-trailer single-group mode we can skip
the hash insertion and lookup, since we only see one value per commit).
There is one subtlety: we now care about the case when no group bit is
set (in which case we default to showing the author). The caller in
builtin/log.c needs to be adapted to ask explicitly for authors, rather
than relying on shortlog_init(). It would be possible with some
gymnastics to make this keep working as-is, but it's not worth it for a
single caller.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-09-27 08:40:15 +00:00
|
|
|
} groups;
|
|
|
|
struct string_list trailers;
|
2022-10-24 18:55:39 +00:00
|
|
|
struct string_list format;
|
2008-02-25 23:24:14 +00:00
|
|
|
|
|
|
|
int email;
|
2008-07-21 18:03:49 +00:00
|
|
|
struct string_list mailmap;
|
2016-06-22 15:01:49 +00:00
|
|
|
FILE *file;
|
2008-02-25 23:24:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void shortlog_init(struct shortlog *log);
|
2022-10-24 18:55:41 +00:00
|
|
|
void shortlog_finish_setup(struct shortlog *log);
|
2008-02-25 23:24:14 +00:00
|
|
|
|
|
|
|
void shortlog_add_commit(struct shortlog *log, struct commit *commit);
|
|
|
|
|
|
|
|
void shortlog_output(struct shortlog *log);
|
|
|
|
|
|
|
|
#endif
|