(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 <'diff.context configuration'>)} spids: [13] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {(SQ <setup>)} { (SQ <'\n'> <'\tcat >template <<-\\EOF &&\n'> <'\tfirstline\n'> <'\tb\n'> <'\tc\n'> <'\td\n'> <'\te\n'> <'\tf\n'> <'\tpreline\n'> <'\tTARGET\n'> <'\tpostline\n'> <'\ti\n'> <'\tj\n'> <'\tk\n'> <'\tl\n'> <'\tm\n'> <'\tn\n'> <'\tEOF\n'> <'\tsed "/TARGET/d" >x <template &&\n'> <'\tgit update-index --add x &&\n'> <'\tgit commit -m initial &&\n'> <'\n'> <'\tsed "s/TARGET/ADDED/" >x <template &&\n'> <'\tgit update-index --add x &&\n'> <'\tgit commit -m next &&\n'> <'\n'> <'\tsed "s/TARGET/MODIFIED/" >x <template\n'> ) } ) (C {<test_expect_success>} {(SQ <'the default number of context lines is 3'>)} { (SQ <'\n'> <'\tgit diff >output &&\n'> <'\t! grep "^ d" output &&\n'> <'\tgrep "^ e" output &&\n'> <'\tgrep "^ j" output &&\n'> <'\t! grep "^ k" output\n'> ) } ) (C {<test_expect_success>} {(SQ <'diff.context honored by "log"'>)} { (SQ <'\n'> <'\tgit log -1 -p >output &&\n'> <'\t! grep firstline output &&\n'> <'\tgit config diff.context 8 &&\n'> <'\tgit log -1 -p >output &&\n'> <'\tgrep "^ firstline" output\n'> ) } ) (C {<test_expect_success>} {(SQ <'The -U option overrides diff.context'>)} { (SQ <'\n'> <'\tgit config diff.context 8 &&\n'> <'\tgit log -U4 -1 >output &&\n'> <'\t! grep "^ firstline" output\n'> ) } ) (C {<test_expect_success>} {(SQ <'diff.context honored by "diff"'>)} { (SQ <'\n'> <'\tgit config diff.context 8 &&\n'> <'\tgit diff >output &&\n'> <'\tgrep "^ firstline" output\n'> ) } ) (C {<test_expect_success>} {(SQ <'plumbing not affected'>)} { (SQ <'\n'> <'\tgit config diff.context 8 &&\n'> <'\tgit diff-files -p >output &&\n'> <'\t! grep "^ firstline" output\n'> ) } ) (C {<test_expect_success>} {(SQ <'non-integer config parsing'>)} { (SQ <'\n'> <'\tgit config diff.context no &&\n'> <'\ttest_must_fail git diff 2>output &&\n'> <'\ttest_i18ngrep "bad numeric config value" output\n'> ) } ) (C {<test_expect_success>} {(SQ <'negative integer config parsing'>)} { (SQ <'\n'> <'\tgit config diff.context -1 &&\n'> <'\ttest_must_fail git diff 2>output &&\n'> <'\ttest_i18ngrep "bad config variable" output\n'> ) } ) (C {<test_expect_success>} {(SQ <'-U0 is valid, so is diff.context=0'>)} { (SQ <'\n'> <'\tgit config diff.context 0 &&\n'> <'\tgit diff >output &&\n'> <'\tgrep "^-ADDED" output &&\n'> <'\tgrep "^+MODIFIED" output\n'> ) } ) (C {<test_done>}) ] )