@matheusbsbs / matheus-bagliano / commits / 023756f4eb
Fork 0

revision walker: --cherry-pick is a limited operation

We used to rely on the fact that cherry-pick would trigger the code path to set limited = 1 in handle_commit(), when an uninteresting commit was encountered. However, when cherry picking between two independent branches, i.e. when there are no merge bases, and there is only linear development (which can happen when you cvsimport a fork of a project), no uninteresting commit will be encountered. So set limited = 1 when --cherry-pick was asked for. Noticed by Martin Bähr. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Sep 15, 2007 at 18:39 UTC 023756f4eb71bfa37e17b0bdbf4b9fcbbba95466
2 files changed +15
revision.c
+1
@@ -1024,6 +1024,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
1024 }
1025 if (!strcmp(arg, "--cherry-pick")) {
1026 revs->cherry_pick = 1;
1027 + revs->limited = 1;
1028 continue;
1029 }
1030 if (!strcmp(arg, "--objects")) {
t/t6007-rev-list-cherry-pick-file.sh
+14
@@ -40,4 +40,18 @@ test_expect_success '--cherry-pick bar does not come up empty' '
40 ! test -z "$(git rev-list --left-right --cherry-pick B...C -- bar)"
41 '
42
43 +test_expect_success '--cherry-pick with independent, but identical branches' '
44 + git symbolic-ref HEAD refs/heads/independent &&
45 + rm .git/index &&
46 + echo Hallo > foo &&
47 + git add foo &&
48 + test_tick &&
49 + git commit -m "independent" &&
50 + echo Bello > foo &&
51 + test_tick &&
52 + git commit -m "independent, too" foo &&
53 + test -z "$(git rev-list --left-right --cherry-pick \
54 + HEAD...master -- foo)"
55 +'
56 +
57 test_done