@matheusbsbs / matheus-bagliano / commits / 59c8afdf47
Fork 0

rev-list: documentation and test for --left/right-only

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael J Gruber committed Feb 21, 2011 at 17:09 UTC 59c8afdf475d2b072fb63383df9f62afd2b3b1ee
3 files changed +43 -4
Documentation/git-rev-list.txt
+2
@@ -31,6 +31,8 @@ SYNOPSIS
31 [ \--parents ]
32 [ \--timestamp ]
33 [ \--left-right ]
34 + [ \--left-only ]
35 + [ \--right-only ]
36 [ \--cherry-pick ]
37 [ \--encoding[=<encoding>] ]
38 [ \--(author|committer|grep)=<pattern> ]
Documentation/rev-list-options.txt
+13
@@ -319,6 +319,19 @@ from the other branch (for example, "3rd on b" may be cherry-picked
319 from branch A). With this option, such pairs of commits are
320 excluded from the output.
321
322 +--left-only::
323 +--right-only::
324 +
325 + List only commits on the respective side of a symmetric range,
326 + i.e. only those which would be marked `<` resp. `>` by
327 + `--left-right`.
328 ++
329 +For example, `--cherry-pick --right-only A...B` omits those
330 +commits from `B` which are in `A` or are patch-equivalent to a commit in
331 +`A`. In other words, this lists the `{plus}` commits from `git cherry A B`.
332 +More precisely, `--cherry-pick --right-only --no-merges` gives the exact
333 +list.
334 +
335 -g::
336 --walk-reflogs::
337
t/t6007-rev-list-cherry-pick-file.sh
+28 -4
@@ -4,14 +4,14 @@ test_description='test git rev-list --cherry-pick -- file'
4
5 . ./test-lib.sh
6
7 -# A---B---D
7 +# A---B---D---F
8 # \
9 # \
10 # C---E
11 #
12 # B changes a file foo.c, adding a line of text. C changes foo.c as
13 # well as bar.c, but the change in foo.c was identical to change B.
14 -# D and C change bar in the same way, E differently.
14 +# D and C change bar in the same way, E and F differently.
15
16 test_expect_success setup '
17 echo Hallo > foo &&
@@ -40,7 +40,12 @@ test_expect_success setup '
40 git add bar &&
41 test_tick &&
42 git commit -m "D" &&
43 - git tag D
43 + git tag D &&
44 + echo Nello > bar &&
45 + git add bar &&
46 + test_tick &&
47 + git commit -m "F" &&
48 + git tag F
49 '
50
51 cat >expect <<EOF
@@ -83,11 +88,30 @@ test_expect_success 'bar does not come up empty' '
88 '
89
90 cat >expect <<EOF
91 +<tags/F
92 >tags/E
93 EOF
94
95 test_expect_success '--cherry-pick bar does not come up empty (II)' '
90 - git rev-list --left-right --cherry-pick D...E -- bar > actual &&
96 + git rev-list --left-right --cherry-pick F...E -- bar > actual &&
97 + git name-rev --stdin --name-only --refs="*tags/*" \
98 + < actual > actual.named &&
99 + test_cmp actual.named expect
100 +'
101 +
102 +cat >expect <<EOF
103 +tags/E
104 +EOF
105 +
106 +test_expect_success '--cherry-pick --right-only' '
107 + git rev-list --cherry-pick --right-only F...E -- bar > actual &&
108 + git name-rev --stdin --name-only --refs="*tags/*" \
109 + < actual > actual.named &&
110 + test_cmp actual.named expect
111 +'
112 +
113 +test_expect_success '--cherry-pick --left-only' '
114 + git rev-list --cherry-pick --left-only E...F -- bar > actual &&
115 git name-rev --stdin --name-only --refs="*tags/*" \
116 < actual > actual.named &&
117 test_cmp actual.named expect