git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-format-patch -3

From
Junio C Hamano <junkio@cox.net>
Date
Jan 17, 2007, 21:35 UTC
Message-ID
<7vk5zlqqum.fsf@assigned-by-dhcp.cox.net>

This teaches "git-format-patch" to honor the --max-count parameter revision traversal machinery takes, so that you can say "git-format-patch -3" to process the three topmost commits from the current HEAD (or "git-format-patch -2 topic" to name a specific branch).

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 * I think this is incompatible with --ignore-if-upstream, which
   I haven't bothered to look into yet.
   Likes, dislikes?
 builtin-log.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/builtin-log.c b/builtin-log.c
index 1cd9d3f..9453e6d 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)
Next: Junio C Hamano
Message 1 of 8 in “git-format-patch -3”
  1. git-format-patch -3Junio C Hamano, Jan 17, 2007
  2. Add --summary to git-format-patch by defaultJunio C Hamano, Jan 17, 2007
  3. git-format-patch: make --binary on by defaultJunio C Hamano, Jan 17, 2007
  4. Changes to e-mailed patch handling in v1.5.0Junio C Hamano, Jan 17, 2007
  5. Andy ParkinsJan 18, 2007
  6. Brian GernhardtJan 18, 2007
  7. Shawn O. PearceJan 18, 2007
  8. Johannes SchindelinJan 18, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.