@matheusbsbs / matheus-bagliano / commits / 9f0be82123
Fork 0

t1506: rev-parse A..B and A...B

Because these constructs can be used to parse user input to be passed to rev-list --objects, e.g. range=$(git rev-parse v1.0..v2.0) && git rev-list --objects $range | git pack-objects --stdin the endpoints (v1.0 and v2.0 in the example) are shown without peeling them to underlying commits, even when they are annotated tags. Make sure it stays that way. While at it, ensure "rev-parse A...B" also keeps the endpoints A and B unpeeled, even though the negative side (i.e. the merge-base between A and B) has to become a commit. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Sep 24, 2020 at 18:44 UTC 9f0be821238fcae33f33d736d2118b4ffdcebd0c
1 file changed +18
t/t1506-rev-parse-diagnosis.sh
+18
@@ -190,6 +190,24 @@ test_expect_success 'dotdot is not an empty set' '
190 test_cmp expect actual
191 '
192
193 +test_expect_success 'dotdot does not peel endpoints' '
194 + git tag -a -m "annote" annotated HEAD &&
195 + A=$(git rev-parse annotated) &&
196 + H=$(git rev-parse annotated^0) &&
197 + {
198 + echo $A && echo ^$A
199 + } >expect-with-two-dots &&
200 + {
201 + echo $A && echo $A && echo ^$H
202 + } >expect-with-merge-base &&
203 +
204 + git rev-parse annotated..annotated >actual-with-two-dots &&
205 + test_cmp expect-with-two-dots actual-with-two-dots &&
206 +
207 + git rev-parse annotated...annotated >actual-with-merge-base &&
208 + test_cmp expect-with-merge-base actual-with-merge-base
209 +'
210 +
211 test_expect_success 'arg before dashdash must be a revision (missing)' '
212 test_must_fail git rev-parse foobar -- 2>stderr &&
213 test_i18ngrep "bad revision" stderr