#!/bin/sh global test_description := ''git add --all'' source ./test-lib.sh test_expect_success setup ' ( echo .gitignore echo will-remove ) >expect && ( echo actual echo expect echo ignored ) >.gitignore && git --literal-pathspecs add --all && >will-remove && git add --all && test_tick && git commit -m initial && git ls-files >actual && test_cmp expect actual ' test_expect_success 'git add --all' ' ( echo .gitignore echo not-ignored echo "M .gitignore" echo "A not-ignored" echo "D will-remove" ) >expect && >ignored && >not-ignored && echo modification >>.gitignore && rm -f will-remove && git add --all && git update-index --refresh && git ls-files >actual && git diff-index --name-status --cached HEAD >>actual && test_cmp expect actual ' test_expect_success 'Just "git add" is a no-op' ' git reset --hard && echo >will-remove && >will-not-be-added && git add && git diff-index --name-status --cached HEAD >actual && >expect && test_cmp expect actual ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"git add --all">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"\t(\n"> <"\t\techo .gitignore\n"> <"\t\techo will-remove\n"> <"\t) >expect &&\n"> <"\t(\n"> <"\t\techo actual\n"> <"\t\techo expect\n"> <"\t\techo ignored\n"> <"\t) >.gitignore &&\n"> <"\tgit --literal-pathspecs add --all &&\n"> <"\t>will-remove &&\n"> <"\tgit add --all &&\n"> <"\ttest_tick &&\n"> <"\tgit commit -m initial &&\n"> <"\tgit ls-files >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"git add --all">)} { (SQ <"\n"> <"\t(\n"> <"\t\techo .gitignore\n"> <"\t\techo not-ignored\n"> <"\t\techo \"M\t.gitignore\"\n"> <"\t\techo \"A\tnot-ignored\"\n"> <"\t\techo \"D\twill-remove\"\n"> <"\t) >expect &&\n"> <"\t>ignored &&\n"> <"\t>not-ignored &&\n"> <"\techo modification >>.gitignore &&\n"> <"\trm -f will-remove &&\n"> <"\tgit add --all &&\n"> <"\tgit update-index --refresh &&\n"> <"\tgit ls-files >actual &&\n"> <"\tgit diff-index --name-status --cached HEAD >>actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Just \"git add\" is a no-op">)} { (SQ <"\n"> <"\tgit reset --hard &&\n"> <"\techo >will-remove &&\n"> <"\t>will-not-be-added &&\n"> <"\tgit add &&\n"> <"\tgit diff-index --name-status --cached HEAD >actual &&\n"> <"\t>expect &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_done)}) ] )