Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t1505-rev-parse-last.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t1505-rev-parse-last.sh` 64 lines ยท 965 bytes Raw Blame History 1 #!/bin/sh 2 3 test_description='test @{-N} syntax' 4 5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main 6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME 7 8 . ./test-lib.sh 9 10 11 make_commit () { 12 echo "$1" > "$1" && 13 git add "$1" && 14 git commit -m "$1" 15 } 16 17 18 test_expect_success 'setup' ' 19 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 28 29 ' 30 31 # 1 -- 2 -- 3 main 32 # \ \ 33 # \ \ 34 # --- 4 --- 5 side 35 # 36 # and 'side' should be the last branch 37 38 test_expect_success '@{-1} works' ' 39 test_cmp_rev side @{-1} 40 ' 41 42 test_expect_success '@{-1}~2 works' ' 43 test_cmp_rev side~2 @{-1}~2 44 ' 45 46 test_expect_success '@{-1}^2 works' ' 47 test_cmp_rev side^2 @{-1}^2 48 ' 49 50 test_expect_success '@{-1}@{1} works' ' 51 test_cmp_rev side@{1} @{-1}@{1} 52 ' 53 54 test_expect_success '@{-2} works' ' 55 test_cmp_rev main @{-2} 56 ' 57 58 test_expect_success '@{-3} fails' ' 59 test_must_fail git rev-parse @{-3} 60 ' 61 62 test_done 63 64