Nguyễn Thái Ngọc Duy | 6fd09f5 | 2011-05-08 18:08:26 +0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | test_description='magic pathspec tests using git-log' |
| 4 | |
| 5 | . ./test-lib.sh |
| 6 | |
| 7 | test_expect_success 'setup' ' |
| 8 | test_commit initial && |
| 9 | test_tick && |
| 10 | git commit --allow-empty -m empty && |
| 11 | mkdir sub |
| 12 | ' |
| 13 | |
Nguyễn Thái Ngọc Duy | 4db86e8 | 2013-01-21 20:00:48 +0700 | [diff] [blame] | 14 | test_expect_success '"git log :/" should not be ambiguous' ' |
| 15 | git log :/ |
| 16 | ' |
| 17 | |
| 18 | test_expect_success '"git log :/a" should be ambiguous (applied both rev and worktree)' ' |
| 19 | : >a && |
| 20 | test_must_fail git log :/a 2>error && |
Nguyễn Thái Ngọc Duy | 6fd09f5 | 2011-05-08 18:08:26 +0700 | [diff] [blame] | 21 | grep ambiguous error |
| 22 | ' |
| 23 | |
Nguyễn Thái Ngọc Duy | 4db86e8 | 2013-01-21 20:00:48 +0700 | [diff] [blame] | 24 | test_expect_success '"git log :/a -- " should not be ambiguous' ' |
| 25 | git log :/a -- |
| 26 | ' |
| 27 | |
| 28 | test_expect_success '"git log -- :/a" should not be ambiguous' ' |
| 29 | git log -- :/a |
| 30 | ' |
| 31 | |
Nguyễn Thái Ngọc Duy | 6fd09f5 | 2011-05-08 18:08:26 +0700 | [diff] [blame] | 32 | test_expect_success '"git log :" should be ambiguous' ' |
| 33 | test_must_fail git log : 2>error && |
| 34 | grep ambiguous error |
| 35 | ' |
| 36 | |
| 37 | test_expect_success 'git log -- :' ' |
| 38 | git log -- : |
| 39 | ' |
| 40 | |
| 41 | test_expect_success 'git log HEAD -- :/' ' |
| 42 | cat >expected <<-EOF && |
| 43 | 24b24cf initial |
| 44 | EOF |
| 45 | (cd sub && git log --oneline HEAD -- :/ >../actual) && |
| 46 | test_cmp expected actual |
| 47 | ' |
| 48 | |
Nguyễn Thái Ngọc Duy | c8556c6 | 2013-10-19 09:41:24 +0700 | [diff] [blame] | 49 | test_expect_success 'command line pathspec parsing for "git log"' ' |
| 50 | git reset --hard && |
| 51 | >a && |
| 52 | git add a && |
| 53 | git commit -m "add an empty a" --allow-empty && |
| 54 | echo 1 >a && |
| 55 | git commit -a -m "update a to 1" && |
| 56 | git checkout HEAD^ && |
| 57 | echo 2 >a && |
| 58 | git commit -a -m "update a to 2" && |
| 59 | test_must_fail git merge master && |
| 60 | git add a && |
| 61 | git log --merge -- a |
| 62 | ' |
| 63 | |
Nguyễn Thái Ngọc Duy | 6fd09f5 | 2011-05-08 18:08:26 +0700 | [diff] [blame] | 64 | test_done |