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

[PATCHv2 8/9] log --cherry: a synonym

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Mar 7, 2011, 12:31 UTC
Message-ID
<83edad511550713d81a7aedec9fb852c117556fc.1299499429.git.git@drmicha.warpmail.net>
In-Reply-To
<cover.1299499429.git.git@drmicha.warpmail.net>

At the porcelain level, because by definition there are many more contributors than integrators, it makes sense to give a handy short-hand for --right-only used with --cherry-mark and --no-merges. Make it so.

In other words, this provides "git cherry with rev-list interface".
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 Documentation/rev-list-options.txt |    8 ++++++++
 revision.c                         |   10 +++++++++-
 2 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 4755b83..95d209c 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -337,6 +337,14 @@ commits from `B` which are in `A` or are patch-equivalent to a commit in
 More precisely, `--cherry-pick --right-only --no-merges` gives the exact
 list.
 
+--cherry::
+
+	A synonym for `--right-only --cherry-mark --no-merges`; useful to
+	limit the output to the commits on our side and mark those that
+	have been applied to the other side of a forked history with
+	`git log --cherry upstream...mybranch`, similar to
+	`git cherry upstream mybranch`.
+
 -g::
 --walk-reflogs::
 
diff --git a/revision.c b/revision.c
index 3da403e..61f571e 100644
--- a/revision.c
+++ b/revision.c
@@ -1289,12 +1289,20 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 		revs->left_right = 1;
 	} else if (!strcmp(arg, "--left-only")) {
 		if (revs->right_only)
-			die("--left-only is incompatible with --right-only");
+			die("--left-only is incompatible with --right-only"
+			    " or --cherry");
 		revs->left_only = 1;
 	} else if (!strcmp(arg, "--right-only")) {
 		if (revs->left_only)
 			die("--right-only is incompatible with --left-only");
 		revs->right_only = 1;
+	} else if (!strcmp(arg, "--cherry")) {
+		if (revs->left_only)
+			die("--cherry is incompatible with --left-only");
+		revs->cherry_mark = 1;
+		revs->right_only = 1;
+		revs->no_merges = 1;
+		revs->limited = 1;
 	} else if (!strcmp(arg, "--count")) {
 		revs->count = 1;
 	} else if (!strcmp(arg, "--cherry-mark")) {
-- 
1.7.4.1.299.g567d7.dirty
Previous: Michael J GruberNext: Michael J Gruber
Message 11 of 30 in “[PATCHv2 0/9] --left/right-only and --cherry-mark”
  1. Michael J GruberMar 7, 2011
  2. 1/9 revlist.c: introduce --left/right-only for unsymmetric pickingMichael J Gruber, Mar 7, 2011
  3. 2/9 t6007: Make sure we test --cherry-pickMichael J Gruber, Mar 7, 2011
  4. 3/9 rev-list: documentation and test for --left/right-onlyMichael J Gruber, Mar 7, 2011
  5. 4/9 rev-list: --left/right-only are mutually exclusiveMichael J Gruber, Mar 7, 2011
  6. 5/9 rev-list/log: factor out revision mark generationMichael J Gruber, Mar 7, 2011
  7. 6/9 revision.c: introduce --cherry-markMichael J Gruber, Mar 7, 2011
  8. Junio C HamanoMar 9, 2011
  9. 6/9 revision.c: introduce --cherry-markMichael J Gruber, Mar 10, 2011
  10. 7/9 rev-list: documentation and test for --cherry-markMichael J Gruber, Mar 7, 2011
  11. 8/9 log --cherry: a synonymMichael J Gruber, Mar 7, 2011
  12. 9/9 t6007: test rev-list --cherryMichael J Gruber, Mar 7, 2011
  13. Junio C HamanoMar 9, 2011
  14. Michael J GruberMar 10, 2011
  15. Junio C HamanoMar 10, 2011
  16. Michael J GruberMar 10, 2011
  17. 00/10 --left/right-only and --cherry-markMichael J Gruber, Mar 10, 2011
  18. 01/10 revlist.c: introduce --left/right-only for unsymmetric pickingMichael J Gruber, Mar 10, 2011
  19. 02/10 t6007: Make sure we test --cherry-pickMichael J Gruber, Mar 10, 2011
  20. 03/10 rev-list: documentation and test for --left/right-onlyMichael J Gruber, Mar 10, 2011
  21. 04/10 rev-list: --left/right-only are mutually exclusiveMichael J Gruber, Mar 10, 2011
  22. 05/10 rev-list/log: factor out revision mark generationMichael J Gruber, Mar 10, 2011
  23. 06/10 revision.c: introduce --cherry-markMichael J Gruber, Mar 10, 2011
  24. 07/10 rev-list: documentation and test for --cherry-markMichael J Gruber, Mar 10, 2011
  25. 08/10 log --cherry: a synonymMichael J Gruber, Mar 10, 2011
  26. 09/10 t6007: test rev-list --cherryMichael J Gruber, Mar 10, 2011
  27. 10/10 git-log: put space after commit markMichael J Gruber, Mar 10, 2011
  28. Junio C HamanoMar 10, 2011
  29. Michael J GruberMar 11, 2011
  30. Junio C HamanoMar 11, 2011

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.