Makefile: add QUIET_GEN to "cscope" target
[git/debian.git] / t / t1505-rev-parse-last.sh
blob2803ca9489c7c6bc2accd85c62ec52805ce2bce3
1 #!/bin/sh
3 test_description='test @{-N} syntax'
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
8 . ./test-lib.sh
11 make_commit () {
12 echo "$1" > "$1" &&
13 git add "$1" &&
14 git commit -m "$1"
18 test_expect_success 'setup' '
20 make_commit 1 &&
21 git branch side &&
22 make_commit 2 &&
23 make_commit 3 &&
24 git checkout side &&
25 make_commit 4 &&
26 git merge main &&
27 git checkout main
31 # 1 -- 2 -- 3 main
32 # \ \
33 # \ \
34 # --- 4 --- 5 side
36 # and 'side' should be the last branch
38 test_expect_success '@{-1} works' '
39 test_cmp_rev side @{-1}
42 test_expect_success '@{-1}~2 works' '
43 test_cmp_rev side~2 @{-1}~2
46 test_expect_success '@{-1}^2 works' '
47 test_cmp_rev side^2 @{-1}^2
50 test_expect_success '@{-1}@{1} works' '
51 test_cmp_rev side@{1} @{-1}@{1}
54 test_expect_success '@{-2} works' '
55 test_cmp_rev main @{-2}
58 test_expect_success '@{-3} fails' '
59 test_must_fail git rev-parse @{-3}
62 test_done