summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ec014ea)
raw | patch | inline | side by side (parent: ec014ea)
author | Michael J Gruber <git@drmicha.warpmail.net> | |
Tue, 26 Apr 2011 08:24:29 +0000 (10:24 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 26 Apr 2011 20:13:20 +0000 (13:13 -0700) |
When --count is used with --cherry-mark, omit the patch equivalent
commits from the count for left and right commits and print the count of
equivalent commits separately.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
commits from the count for left and right commits and print the count of
equivalent commits separately.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/rev-list-options.txt | patch | blob | history | |
builtin/rev-list.c | patch | blob | history | |
revision.h | patch | blob | history | |
t/t6007-rev-list-cherry-pick-file.sh | patch | blob | history |
index 73111bb0512476cb1d1786d65c416b7f4efd94cf..52bae31fcb7f741c34911d94a9253a2a546ee2c2 100644 (file)
Print a number stating how many commits would have been
listed, and suppress all other output. When used together
with '--left-right', instead print the counts for left and
- right commits, separated by a tab.
+ right commits, separated by a tab. When used together with
+ '--cherry-mark', omit patch equivalent commits from these
+ counts and print the count for equivalent commits separated
+ by a tab.
endif::git-rev-list[]
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 9bfb94201f298f5902c6da13b12f4ca539bb86ed..4be66998f6bcb998df094d0c434dfab6bbdcc8c7 100644 (file)
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
graph_show_commit(revs->graph);
if (revs->count) {
- if (commit->object.flags & SYMMETRIC_LEFT)
+ if (commit->object.flags & PATCHSAME)
+ revs->count_same++;
+ else if (commit->object.flags & SYMMETRIC_LEFT)
revs->count_left++;
else
revs->count_right++;
&info);
if (revs.count) {
- if (revs.left_right)
+ if (revs.left_right && revs.cherry_mark)
+ printf("%d\t%d\t%d\n", revs.count_left, revs.count_right, revs.count_same);
+ else if (revs.left_right)
printf("%d\t%d\n", revs.count_left, revs.count_right);
+ else if (revs.cherry_mark)
+ printf("%d\t%d\n", revs.count_left + revs.count_right, revs.count_same);
else
printf("%d\n", revs.count_left + revs.count_right);
}
diff --git a/revision.h b/revision.h
index 9fd8f3016fe8f935f176f57c615f72df8ba8d157..bca9947977c50d151b0fed90931ec52112e72bae 100644 (file)
--- a/revision.h
+++ b/revision.h
/* commit counts */
int count_left;
int count_right;
+ int count_same;
};
#define REV_TREE_SAME 0
index cacf3de6c9f31889fd8df0bc0cebbbc74e3525bd..28d4f6b259c1696435698cb3826c837c8eaf90e3 100755 (executable)
test_cmp actual.named expect
'
+cat >expect <<EOF
+1 1
+EOF
+
+test_expect_success '--cherry --count' '
+ git rev-list --cherry --count F...E -- bar > actual &&
+ test_cmp actual expect
+'
+
+cat >expect <<EOF
+2 2
+EOF
+
+test_expect_success '--cherry-mark --count' '
+ git rev-list --cherry-mark --count F...E -- bar > actual &&
+ test_cmp actual expect
+'
+
+cat >expect <<EOF
+1 1 2
+EOF
+
+test_expect_success '--cherry-mark --left-right --count' '
+ git rev-list --cherry-mark --left-right --count F...E -- bar > actual &&
+ test_cmp actual expect
+'
+
test_expect_success '--cherry-pick with independent, but identical branches' '
git symbolic-ref HEAD refs/heads/independent &&
rm .git/index &&