(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: {(SQ <'git show'>)} spids: [4] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\techo hello world >foo &&\n'> <'\tH=$(git hash-object -w foo) &&\n'> <'\tgit tag -a foo-tag -m "Tags $H" $H &&\n'> <'\tHH=$(expr "$H" : "\\(..\\)") &&\n'> <'\tH38=$(expr "$H" : "..\\(.*\\)") &&\n'> <'\trm -f .git/objects/$HH/$H38\n'> ) } ) (C {<test_expect_success>} {(SQ <'showing a tag that point at a missing object'>)} {(SQ <'\n'> <'\ttest_must_fail git --no-pager show foo-tag\n'>)} ) (C {<test_expect_success>} {(SQ <'set up a bit of history'>)} { (SQ <'\n'> <'\ttest_commit main1 &&\n'> <'\ttest_commit main2 &&\n'> <'\ttest_commit main3 &&\n'> <'\tgit tag -m "annotated tag" annotated &&\n'> <'\tgit checkout -b side HEAD^^ &&\n'> <'\ttest_commit side2 &&\n'> <'\ttest_commit side3 &&\n'> <'\ttest_merge merge main3\n'> ) } ) (C {<test_expect_success>} {(SQ <'showing two commits'>)} { (SQ <'\n'> <'\tcat >expect <<-EOF &&\n'> <'\tcommit $(git rev-parse main2)\n'> <'\tcommit $(git rev-parse main3)\n'> <'\tEOF\n'> <'\tgit show main2 main3 >actual &&\n'> <'\tgrep ^commit actual >actual.filtered &&\n'> <'\ttest_cmp expect actual.filtered\n'> ) } ) (C {<test_expect_success>} {(SQ <'showing a range walks (linear)'>)} { (SQ <'\n'> <'\tcat >expect <<-EOF &&\n'> <'\tcommit $(git rev-parse main3)\n'> <'\tcommit $(git rev-parse main2)\n'> <'\tEOF\n'> <'\tgit show main1..main3 >actual &&\n'> <'\tgrep ^commit actual >actual.filtered &&\n'> <'\ttest_cmp expect actual.filtered\n'> ) } ) (C {<test_expect_success>} {(SQ <'showing a range walks (Y shape, ^ first)'>)} { (SQ <'\n'> <'\tcat >expect <<-EOF &&\n'> <'\tcommit $(git rev-parse main3)\n'> <'\tcommit $(git rev-parse main2)\n'> <'\tEOF\n'> <'\tgit show ^side3 main3 >actual &&\n'> <'\tgrep ^commit actual >actual.filtered &&\n'> <'\ttest_cmp expect actual.filtered\n'> ) } ) (C {<test_expect_success>} {(SQ <'showing a range walks (Y shape, ^ last)'>)} { (SQ <'\n'> <'\tcat >expect <<-EOF &&\n'> <'\tcommit $(git rev-parse main3)\n'> <'\tcommit $(git rev-parse main2)\n'> <'\tEOF\n'> <'\tgit show main3 ^side3 >actual &&\n'> <'\tgrep ^commit actual >actual.filtered &&\n'> <'\ttest_cmp expect actual.filtered\n'> ) } ) (C {<test_expect_success>} {(SQ <'showing with -N walks'>)} { (SQ <'\n'> <'\tcat >expect <<-EOF &&\n'> <'\tcommit $(git rev-parse main3)\n'> <'\tcommit $(git rev-parse main2)\n'> <'\tEOF\n'> <'\tgit show -2 main3 >actual &&\n'> <'\tgrep ^commit actual >actual.filtered &&\n'> <'\ttest_cmp expect actual.filtered\n'> ) } ) (C {<test_expect_success>} {(SQ <'showing annotated tag'>)} { (SQ <'\n'> <'\tcat >expect <<-EOF &&\n'> <'\ttag annotated\n'> <'\tcommit $(git rev-parse annotated^{commit})\n'> <'\tEOF\n'> <'\tgit show annotated >actual &&\n'> <'\tgrep -E "^(commit|tag)" actual >actual.filtered &&\n'> <'\ttest_cmp expect actual.filtered\n'> ) } ) (C {<test_expect_success>} {(SQ <'showing annotated tag plus commit'>)} { (SQ <'\n'> <'\tcat >expect <<-EOF &&\n'> <'\ttag annotated\n'> <'\tcommit $(git rev-parse annotated^{commit})\n'> <'\tcommit $(git rev-parse side3)\n'> <'\tEOF\n'> <'\tgit show annotated side3 >actual &&\n'> <'\tgrep -E "^(commit|tag)" actual >actual.filtered &&\n'> <'\ttest_cmp expect actual.filtered\n'> ) } ) (C {<test_expect_success>} {(SQ <'showing range'>)} { (SQ <'\n'> <'\tcat >expect <<-EOF &&\n'> <'\tcommit $(git rev-parse main3)\n'> <'\tcommit $(git rev-parse main2)\n'> <'\tEOF\n'> <'\tgit show ^side3 annotated >actual &&\n'> <'\tgrep -E "^(commit|tag)" actual >actual.filtered &&\n'> <'\ttest_cmp expect actual.filtered\n'> ) } ) (C {<test_expect_success>} {(SQ <'-s suppresses diff'>)} { (SQ <'\n'> <'\tcat >expect <<-\\EOF &&\n'> <'\tmerge\n'> <'\tmain3\n'> <'\tEOF\n'> <'\tgit show -s --format=%s merge main3 >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'--quiet suppresses diff'>)} { (SQ <'\n'> <'\techo main3 >expect &&\n'> <'\tgit show --quiet --format=%s main3 >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'show --graph is forbidden'>)} {(SQ <'\n'> <' test_must_fail git show --graph HEAD\n'>)} ) (C {<test_done>}) ] )