summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/git-format-patch.txt3
-rw-r--r--builtin-log.c9
2 files changed, 10 insertions, 2 deletions
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index 574cf76dca..811c6e2e77 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -126,6 +126,9 @@ git-format-patch -M -B origin::
understand renaming patches, so use it only when you know
the recipient uses git to apply your patch.
+git-format-patch -3::
+ Extract three topmost commits from the current branch
+ and format them as e-mailable patches.
See Also
--------
diff --git a/builtin-log.c b/builtin-log.c
index 1cd9d3f768..9453e6d2db 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -482,8 +482,13 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
}
if (rev.pending.nr == 1) {
- rev.pending.objects[0].item->flags |= UNINTERESTING;
- add_head(&rev);
+ if (rev.max_count < 0) {
+ rev.pending.objects[0].item->flags |= UNINTERESTING;
+ add_head(&rev);
+ }
+ /* Otherwise, it is "format-patch -22 HEAD", and
+ * get_revision() would return only the specified count.
+ */
}
if (ignore_if_in_upstream)