]> git.ipfire.org Git - thirdparty/git.git/blame - t/t1505-rev-parse-last.sh
path.c: don't call the match function without value in trie_find()
[thirdparty/git.git] / t / t1505-rev-parse-last.sh
CommitLineData
d18ba221
TR
1#!/bin/sh
2
3test_description='test @{-N} syntax'
4
5. ./test-lib.sh
6
7
8make_commit () {
9 echo "$1" > "$1" &&
10 git add "$1" &&
11 git commit -m "$1"
12}
13
14
15test_expect_success 'setup' '
16
17 make_commit 1 &&
18 git branch side &&
19 make_commit 2 &&
20 make_commit 3 &&
21 git checkout side &&
22 make_commit 4 &&
23 git merge master &&
24 git checkout master
25
26'
27
28# 1 -- 2 -- 3 master
29# \ \
30# \ \
31# --- 4 --- 5 side
32#
33# and 'side' should be the last branch
34
d18ba221 35test_expect_success '@{-1} works' '
5d77298d 36 test_cmp_rev side @{-1}
d18ba221
TR
37'
38
39test_expect_success '@{-1}~2 works' '
5d77298d 40 test_cmp_rev side~2 @{-1}~2
d18ba221
TR
41'
42
43test_expect_success '@{-1}^2 works' '
5d77298d 44 test_cmp_rev side^2 @{-1}^2
d18ba221
TR
45'
46
aa9c55b6 47test_expect_success '@{-1}@{1} works' '
5d77298d 48 test_cmp_rev side@{1} @{-1}@{1}
d18ba221
TR
49'
50
51test_expect_success '@{-2} works' '
5d77298d 52 test_cmp_rev master @{-2}
d18ba221
TR
53'
54
55test_expect_success '@{-3} fails' '
56 test_must_fail git rev-parse @{-3}
57'
58
59test_done
60
61