#!/bin/sh global test_description := ''test dwim of revs versus pathspecs in revision parser'' source ./test-lib.sh test_expect_success 'setup' ' test_commit base && echo content >"br[ack]ets" && git add . && test_tick && git commit -m brackets ' test_expect_success 'non-rev wildcard dwims to pathspec' ' git log -- "*.t" >expect && git log "*.t" >actual && test_cmp expect actual ' test_expect_success 'tree:path with metacharacters dwims to rev' ' git show "HEAD:br[ack]ets" -- >expect && git show "HEAD:br[ack]ets" >actual && test_cmp expect actual ' test_expect_success '^{foo} with metacharacters dwims to rev' ' git log "HEAD^{/b.*}" -- >expect && git log "HEAD^{/b.*}" >actual && test_cmp expect actual ' test_expect_success '@{foo} with metacharacters dwims to rev' ' git log "HEAD@{now [or thereabouts]}" -- >expect && git log "HEAD@{now [or thereabouts]}" >actual && test_cmp expect actual ' test_expect_success ':/*.t from a subdir dwims to a pathspec' ' mkdir subdir && ( cd subdir && git log -- ":/*.t" >expect && git log ":/*.t" >actual && test_cmp expect actual ) ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"test dwim of revs versus pathspecs in revision parser">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ )} { (SQ <"\n"> <"\ttest_commit base &&\n"> <"\techo content >\"br[ack]ets\" &&\n"> <"\tgit add . &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -m brackets\n"> ) } ) (C {(test_expect_success)} {(SQ <"non-rev wildcard dwims to pathspec">)} { (SQ <"\n"> <"\tgit log -- \"*.t\" >expect &&\n"> <"\tgit log \"*.t\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"tree:path with metacharacters dwims to rev">)} { (SQ <"\n"> <"\tgit show \"HEAD:br[ack]ets\" -- >expect &&\n"> <"\tgit show \"HEAD:br[ack]ets\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"^{foo} with metacharacters dwims to rev">)} { (SQ <"\n"> <"\tgit log \"HEAD^{/b.*}\" -- >expect &&\n"> <"\tgit log \"HEAD^{/b.*}\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"@{foo} with metacharacters dwims to rev">)} { (SQ <"\n"> <"\tgit log \"HEAD@{now [or thereabouts]}\" -- >expect &&\n"> <"\tgit log \"HEAD@{now [or thereabouts]}\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <":/*.t from a subdir dwims to a pathspec">)} { (SQ <"\n"> <"\tmkdir subdir &&\n"> <"\t(\n"> <"\t\tcd subdir &&\n"> <"\t\tgit log -- \":/*.t\" >expect &&\n"> <"\t\tgit log \":/*.t\" >actual &&\n"> <"\t\ttest_cmp expect actual\n"> <"\t)\n"> ) } ) (C {(test_done)}) ] )