summaryrefslogtreecommitdiff
path: root/builtin-log.c
diff options
context:
space:
mode:
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;