{"thread":{"id":"9867","subject":"[PATCH] revision walker: --cherry-pick is a limited operation","startedAt":"2007-09-15T17:39:52Z","lastAt":"2007-09-15T17:39:52Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"53138","messageId":"Pine.LNX.4.64.0709151838270.28586@racer.site","threadId":"9867","inReplyTo":null,"subject":"[PATCH] revision walker: --cherry-pick is a limited operation","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-09-15T17:39:52Z","receivedAt":"2007-09-15T17:39:52Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWe used to rely on the fact that cherry-pick would trigger the code path \nto set limited = 1 in handle_commit(), when an uninteresting commit was \nencountered.\n\nHowever, when cherry picking between two independent branches, i.e. when \nthere are no merge bases, and there is only linear development (which can \nhappen when you cvsimport a fork of a project), no uninteresting commit \nwill be encountered.\n\nSo set limited = 1 when --cherry-pick was asked for.\n\nNoticed by Martin Bähr.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n revision.c                           |    1 +\n t/t6007-rev-list-cherry-pick-file.sh |   14 ++++++++++++++\n 2 files changed, 15 insertions(+), 0 deletions(-)\n\ndiff --git a/revision.c b/revision.c\nindex c193c3e..33d092c 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1024,6 +1024,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--cherry-pick\")) {\n \t\t\t\trevs->cherry_pick = 1;\n+\t\t\t\trevs->limited = 1;\n \t\t\t\tcontinue;\n \t\t\t}\n \t\t\tif (!strcmp(arg, \"--objects\")) {\ndiff --git a/t/t6007-rev-list-cherry-pick-file.sh b/t/t6007-rev-list-cherry-pick-file.sh\nindex 3faeae6..4b8611c 100755\n--- a/t/t6007-rev-list-cherry-pick-file.sh\n+++ b/t/t6007-rev-list-cherry-pick-file.sh\n@@ -40,4 +40,18 @@ test_expect_success '--cherry-pick bar does not come up empty' '\n \t! test -z \"$(git rev-list --left-right --cherry-pick B...C -- bar)\"\n '\n \n+test_expect_success '--cherry-pick with independent, but identical branches' '\n+\tgit symbolic-ref HEAD refs/heads/independent &&\n+\trm .git/index &&\n+\techo Hallo > foo &&\n+\tgit add foo &&\n+\ttest_tick &&\n+\tgit commit -m \"independent\" &&\n+\techo Bello > foo &&\n+\ttest_tick &&\n+\tgit commit -m \"independent, too\" foo &&\n+\ttest -z \"$(git rev-list --left-right --cherry-pick \\\n+\t\tHEAD...master -- foo)\"\n+'\n+\n test_done\n-- \n1.5.3.1.949.g98c3\n"}]}