t4208-log-magic-pathspec.sh 1.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
#!/bin/sh

test_description='magic pathspec tests using git-log'

. ./test-lib.sh

test_expect_success 'setup' '
	test_commit initial &&
	test_tick &&
	git commit --allow-empty -m empty &&
	mkdir sub
'

Duy Nguyen's avatar
Duy Nguyen committed
14 15 16 17 18 19 20
test_expect_success '"git log :/" should not be ambiguous' '
	git log :/
'

test_expect_success '"git log :/a" should be ambiguous (applied both rev and worktree)' '
	: >a &&
	test_must_fail git log :/a 2>error &&
21 22 23
	grep ambiguous error
'

Duy Nguyen's avatar
Duy Nguyen committed
24 25 26 27 28 29 30 31
test_expect_success '"git log :/a -- " should not be ambiguous' '
	git log :/a --
'

test_expect_success '"git log -- :/a" should not be ambiguous' '
	git log -- :/a
'

32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
test_expect_success '"git log :" should be ambiguous' '
	test_must_fail git log : 2>error &&
	grep ambiguous error
'

test_expect_success 'git log -- :' '
	git log -- :
'

test_expect_success 'git log HEAD -- :/' '
	cat >expected <<-EOF &&
	24b24cf initial
	EOF
	(cd sub && git log --oneline HEAD -- :/ >../actual) &&
	test_cmp expected actual
'

49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
test_expect_success 'command line pathspec parsing for "git log"' '
	git reset --hard &&
	>a &&
	git add a &&
	git commit -m "add an empty a" --allow-empty &&
	echo 1 >a &&
	git commit -a -m "update a to 1" &&
	git checkout HEAD^ &&
	echo 2 >a &&
	git commit -a -m "update a to 2" &&
	test_must_fail git merge master &&
	git add a &&
	git log --merge -- a
'

64
test_done