#!/bin/sh global test_description := ''magic pathspec tests using git-log'' source ./test-lib.sh test_expect_success 'setup' ' test_commit initial && test_tick && git commit --allow-empty -m empty && mkdir sub ' 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 && test_i18ngrep ambiguous error ' 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 ' test_expect_success '"git log :" should be ambiguous' ' test_must_fail git log : 2>error && test_i18ngrep 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 ' 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 ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"magic pathspec tests using git-log">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ )} { (SQ <"\n"> <"\ttest_commit initial &&\n"> <"\ttest_tick &&\n"> <"\tgit commit --allow-empty -m empty &&\n"> <"\tmkdir sub\n"> ) } ) (C {(test_expect_success)} {(SQ <"\"git log :/\" should not be ambiguous">)} {(SQ <"\n"> <"\tgit log :/\n">)} ) (C {(test_expect_success)} {(SQ <"\"git log :/a\" should be ambiguous (applied both rev and worktree)">)} { (SQ <"\n"> <"\t: >a &&\n"> <"\ttest_must_fail git log :/a 2>error &&\n"> <"\ttest_i18ngrep ambiguous error\n"> ) } ) (C {(test_expect_success)} {(SQ <"\"git log :/a -- \" should not be ambiguous">)} {(SQ <"\n"> <"\tgit log :/a --\n">)} ) (C {(test_expect_success)} {(SQ <"\"git log -- :/a\" should not be ambiguous">)} {(SQ <"\n"> <"\tgit log -- :/a\n">)} ) (C {(test_expect_success)} {(SQ <"\"git log :\" should be ambiguous">)} {(SQ <"\n"> <"\ttest_must_fail git log : 2>error &&\n"> <"\ttest_i18ngrep ambiguous error\n">)} ) (C {(test_expect_success)} {(SQ <"git log -- :">)} {(SQ <"\n"> <"\tgit log -- :\n">)}) (C {(test_expect_success)} {(SQ <"git log HEAD -- :/">)} { (SQ <"\n"> <"\tcat >expected <<-EOF &&\n"> <"\t24b24cf initial\n"> <"\tEOF\n"> <"\t(cd sub && git log --oneline HEAD -- :/ >../actual) &&\n"> <"\ttest_cmp expected actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"command line pathspec parsing for \"git log\"">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\t>a &&\n"> <"\tgit add a &&\n"> <"\tgit commit -m \"add an empty a\" --allow-empty &&\n"> <"\techo 1 >a &&\n"> <"\tgit commit -a -m \"update a to 1\" &&\n"> <"\tgit checkout HEAD^ &&\n"> <"\techo 2 >a &&\n"> <"\tgit commit -a -m \"update a to 2\" &&\n"> <"\ttest_must_fail git merge master &&\n"> <"\tgit add a &&\n"> <"\tgit log --merge -- a\n"> ) } ) (C {(test_done)}) ] )