@matheusbsbs / matheus-bagliano / commits / 94f605ec07
Fork 0

log --cherry: a synonym

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael J Gruber committed Mar 7, 2011 at 13:31 UTC 94f605ec0798a1f494023b72cd0d1f10b7a264f7
2 files changed +17 -1
Documentation/rev-list-options.txt
+8
@@ -337,6 +337,14 @@ commits from `B` which are in `A` or are patch-equivalent to a commit in
337 More precisely, `--cherry-pick --right-only --no-merges` gives the exact
338 list.
339
340 +--cherry::
341 +
342 + A synonym for `--right-only --cherry-mark --no-merges`; useful to
343 + limit the output to the commits on our side and mark those that
344 + have been applied to the other side of a forked history with
345 + `git log --cherry upstream...mybranch`, similar to
346 + `git cherry upstream mybranch`.
347 +
348 -g::
349 --walk-reflogs::
350
revision.c
+9 -1
@@ -1289,12 +1289,20 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
1289 revs->left_right = 1;
1290 } else if (!strcmp(arg, "--left-only")) {
1291 if (revs->right_only)
1292 - die("--left-only is incompatible with --right-only");
1292 + die("--left-only is incompatible with --right-only"
1293 + " or --cherry");
1294 revs->left_only = 1;
1295 } else if (!strcmp(arg, "--right-only")) {
1296 if (revs->left_only)
1297 die("--right-only is incompatible with --left-only");
1298 revs->right_only = 1;
1299 + } else if (!strcmp(arg, "--cherry")) {
1300 + if (revs->left_only)
1301 + die("--cherry is incompatible with --left-only");
1302 + revs->cherry_mark = 1;
1303 + revs->right_only = 1;
1304 + revs->no_merges = 1;
1305 + revs->limited = 1;
1306 } else if (!strcmp(arg, "--count")) {
1307 revs->count = 1;
1308 } else if (!strcmp(arg, "--cherry-mark")) {