summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2448482)
raw | patch | inline | side by side (parent: 2448482)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Fri, 5 May 2006 02:30:52 +0000 (04:30 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 5 May 2006 21:11:57 +0000 (14:11 -0700) |
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-log.c | patch | blob | history | |
commit.c | patch | blob | history | |
commit.h | patch | blob | history | |
log-tree.c | patch | blob | history | |
rev-list.c | patch | blob | history | |
revision.h | patch | blob | history | |
show-branch.c | patch | blob | history |
diff --git a/builtin-log.c b/builtin-log.c
index 53a47c9aa4b9de6a1a3457847175db766360c6f9..43c7ecd5e92a1662765abffa8c2aff65740fe8a8 100644 (file)
--- a/builtin-log.c
+++ b/builtin-log.c
struct rev_info rev;
int nr = 0, total, i, j;
int use_stdout = 0;
+ int numbered = 0;
init_revisions(&rev);
rev.commit_format = CMIT_FMT_EMAIL;
for (i = 1, j = 1; i < argc; i++) {
if (!strcmp(argv[i], "--stdout"))
use_stdout = 1;
+ else if (!strcmp(argv[i], "-n") ||
+ !strcmp(argv[i], "--numbered"))
+ numbered = 1;
else if (!strcmp(argv[i], "-o")) {
if (argc < 3)
die ("Which directory?");
list[nr - 1] = commit;
}
total = nr;
+ if (numbered)
+ rev.total = total;
while (0 <= --nr) {
int shown;
commit = list[nr];
+ rev.nr = total - nr;
if (!use_stdout)
- reopen_stdout(commit, total - nr);
+ reopen_stdout(commit, rev.nr);
shown = log_tree_commit(&rev, commit);
free(commit->buffer);
commit->buffer = NULL;
diff --git a/commit.c b/commit.c
index 42b44bba52b3bcf8545f7e7753d5ebb755155163..93b3903ea78fac0b5a40074ec64d0c98bb8cfa94 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -489,17 +489,14 @@ static int add_merge_info(enum cmit_fmt fmt, char *buf, const struct commit *com
return offset;
}
-unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit, unsigned long len, char *buf, unsigned long space, int abbrev)
+unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit, unsigned long len, char *buf, unsigned long space, int abbrev, const char *subject)
{
int hdr = 1, body = 0;
unsigned long offset = 0;
int indent = 4;
int parents_shown = 0;
const char *msg = commit->buffer;
- const char *subject = NULL;
- if (fmt == CMIT_FMT_EMAIL)
- subject = "Subject: [PATCH] ";
if (fmt == CMIT_FMT_ONELINE || fmt == CMIT_FMT_EMAIL)
indent = 0;
diff --git a/commit.h b/commit.h
index 01eec60a1ecc2ff3c73850cb510ba71767e47e03..8d7514cd0012377195ef8a5022e98e887fe6a2e1 100644 (file)
--- a/commit.h
+++ b/commit.h
};
extern enum cmit_fmt get_commit_format(const char *arg);
-extern unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *, unsigned long len, char *buf, unsigned long space, int abbrev);
+extern unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *, unsigned long len, char *buf, unsigned long space, int abbrev, const char *subject);
/** Removes the first commit from a list sorted by date, and adds all
* of its parents.
diff --git a/log-tree.c b/log-tree.c
index aaf2b9423f01243584e15e6c93007a3f42c9d917..1ca529d9fefed0d3284c26f5c1503c35ef250779 100644 (file)
--- a/log-tree.c
+++ b/log-tree.c
int abbrev_commit = opt->abbrev_commit ? opt->abbrev : 40;
const char *extra;
int len;
+ char* subject = NULL;
opt->loginfo = NULL;
if (!opt->verbose_header) {
* Print header line of header..
*/
- if (opt->commit_format == CMIT_FMT_EMAIL)
+ if (opt->commit_format == CMIT_FMT_EMAIL) {
+ if (opt->total > 0) {
+ static char buffer[64];
+ snprintf(buffer, sizeof(buffer),
+ "Subject: [PATCH %d/%d] ",
+ opt->nr, opt->total);
+ subject = buffer;
+ } else
+ subject = "Subject: [PATCH] ";
printf("From %s Thu Apr 7 15:13:13 2005\n",
sha1_to_hex(commit->object.sha1));
- else {
+ } else {
printf("%s%s",
opt->commit_format == CMIT_FMT_ONELINE ? "" : "commit ",
diff_unique_abbrev(commit->object.sha1, abbrev_commit));
/*
* And then the pretty-printed message itself
*/
- len = pretty_print_commit(opt->commit_format, commit, ~0u, this_header, sizeof(this_header), abbrev);
+ len = pretty_print_commit(opt->commit_format, commit, ~0u, this_header, sizeof(this_header), abbrev, subject);
printf("%s%s%s", this_header, extra, sep);
}
diff --git a/rev-list.c b/rev-list.c
index 8b0ec388fa0afe5ffb28c94f2e75544612ab7265..235ae4c7e13b7dd26af100c6a1411ebfdeaef354 100644 (file)
--- a/rev-list.c
+++ b/rev-list.c
static char pretty_header[16384];
pretty_print_commit(revs.commit_format, commit, ~0,
pretty_header, sizeof(pretty_header),
- revs.abbrev);
+ revs.abbrev, NULL);
printf("%s%c", pretty_header, hdr_termination);
}
fflush(stdout);
diff --git a/revision.h b/revision.h
index 48d7b4ca94f3fd00f7a1f6a3fb57ebed934ffc0d..62759f7bc05c0133fd900bca15f01c4d17487589 100644 (file)
--- a/revision.h
+++ b/revision.h
unsigned int abbrev;
enum cmit_fmt commit_format;
struct log_info *loginfo;
+ int nr, total;
/* special limits */
int max_count;
diff --git a/show-branch.c b/show-branch.c
index 24efb65e622d8dfe44db22e5bc23c9f8cc328109..5da3a1a90b23646eee18046ba33efe8953f8ba67 100644 (file)
--- a/show-branch.c
+++ b/show-branch.c
struct commit_name *name = commit->object.util;
if (commit->object.parsed)
pretty_print_commit(CMIT_FMT_ONELINE, commit, ~0,
- pretty, sizeof(pretty), 0);
+ pretty, sizeof(pretty), 0, NULL);
else
strcpy(pretty, "(unavailable)");
if (!strncmp(pretty, "[PATCH] ", 8))