summaryrefslogtreecommitdiff
path: root/builtin-log.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2006-05-05 04:30:52 +0200
committerJunio C Hamano <junkio@cox.net>2006-05-05 14:11:57 -0700
commit596524b33d50e47e2375cec9e00aff59f0e8278b (patch)
treee215eb4bddd8aea4b91661d0580eeaffa873abee /builtin-log.c
parent2448482b3d5e265dd29fa38c3827565f6f2f31ec (diff)
downloadgit-596524b33d50e47e2375cec9e00aff59f0e8278b.tar.gz
Teach fmt-patch about --numbered
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-log.c')
-rw-r--r--builtin-log.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/builtin-log.c b/builtin-log.c
index 53a47c9aa4..43c7ecd5e9 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -137,6 +137,7 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
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;
@@ -156,6 +157,9 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
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?");
@@ -186,11 +190,14 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
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;