(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ (Token id:Id.Lit_Chars val:'Test of git add, including the -- option.' span_id:15))} spids: [13] ) ] ) (C {(.)} {(./test-lib.sh)}) (command.ShFunction name: test_mode_in_index body: (command.BraceGroup children: [ (command.Case to_match: { (DQ (command_sub left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:38) command_list: (command.CommandList children: [(C {(git)} {(ls-files)} {(-s)} {(DQ ($ Id.VSub_Number '$2'))})] ) ) ) } arms: [ (case_arm pat_list: [ {(DQ ($ Id.VSub_Number '$1') (' ')) (Id.Lit_Star '*') (DQ ('\t') ($ Id.VSub_Number '$2')) } ] action: [(C {(echo)} {(Id.KW_Pass pass)})] spids: [54 63 71 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (C {(echo)} {(fail)}) (C {(git)} {(ls-files)} {(-s)} {(DQ ($ Id.VSub_Number '$2'))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:94) arg_word: {(1)} ) ] spids: [74 75 99 -1] ) ] ) ] ) ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'Test of git add' span_id:112))} {(SQ (Token id:Id.Lit_Chars val:'touch foo && git add foo' span_id:118))} ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'Post-check that foo is in the index' span_id:127))} {(SQ (Token id:Id.Lit_Chars val:'git ls-files foo | grep foo' span_id:133))} ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'Test that "git add -- -q" works' span_id:142))} {(SQ (Token id:Id.Lit_Chars val:'touch -- -q && git add -- -q' span_id:148))} ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'git add: Test that executable bit is not used if core.filemode=0' span_id: 157 ) ) } { (SQ (Token id:Id.Lit_Chars val:'git config core.filemode 0 &&\n' span_id:163) (Token id:Id.Lit_Chars val:'\t echo foo >xfoo1 &&\n' span_id:164) (Token id:Id.Lit_Chars val:'\t chmod 755 xfoo1 &&\n' span_id:165) (Token id:Id.Lit_Chars val:'\t git add xfoo1 &&\n' span_id:166) (Token id:Id.Lit_Chars val:'\t test_mode_in_index 100644 xfoo1' span_id:167) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'git add: filemode=0 should not get confused by symlink' span_id: 174 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:178) (Token id:Id.Lit_Chars val:'\trm -f xfoo1 &&\n' span_id:179) (Token id:Id.Lit_Chars val:'\ttest_ln_s_add foo xfoo1 &&\n' span_id:180) (Token id:Id.Lit_Chars val:'\ttest_mode_in_index 120000 xfoo1\n' span_id:181) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'git update-index --add: Test that executable bit is not used...' span_id: 190 ) ) } { (SQ (Token id:Id.Lit_Chars val:'git config core.filemode 0 &&\n' span_id:196) (Token id:Id.Lit_Chars val:'\t echo foo >xfoo2 &&\n' span_id:197) (Token id:Id.Lit_Chars val:'\t chmod 755 xfoo2 &&\n' span_id:198) (Token id:Id.Lit_Chars val:'\t git update-index --add xfoo2 &&\n' span_id:199) (Token id:Id.Lit_Chars val:'\t test_mode_in_index 100644 xfoo2' span_id:200) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'git add: filemode=0 should not get confused by symlink' span_id: 207 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:211) (Token id:Id.Lit_Chars val:'\trm -f xfoo2 &&\n' span_id:212) (Token id:Id.Lit_Chars val:'\ttest_ln_s_add foo xfoo2 &&\n' span_id:213) (Token id:Id.Lit_Chars val:'\ttest_mode_in_index 120000 xfoo2\n' span_id:214) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'git update-index --add: Test that executable bit is not used...' span_id: 223 ) ) } { (SQ (Token id:Id.Lit_Chars val:'git config core.filemode 0 &&\n' span_id:229) (Token id: Id.Lit_Chars val: '\t test_ln_s_add xfoo2 xfoo3 &&\t# runs git update-index --add\n' span_id: 230 ) (Token id:Id.Lit_Chars val:'\t test_mode_in_index 120000 xfoo3' span_id:231) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'.gitignore test setup' span_id:238))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:242) (Token id:Id.Lit_Chars val:'\techo "*.ig" >.gitignore &&\n' span_id:243) (Token id:Id.Lit_Chars val:'\tmkdir c.if d.ig &&\n' span_id:244) (Token id:Id.Lit_Chars val:'\t>a.ig && >b.if &&\n' span_id:245) (Token id:Id.Lit_Chars val:'\t>c.if/c.if && >c.if/c.ig &&\n' span_id:246) (Token id:Id.Lit_Chars val:'\t>d.ig/d.if && >d.ig/d.ig\n' span_id:247) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'.gitignore is honored' span_id:254))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:258) (Token id:Id.Lit_Chars val:'\tgit add . &&\n' span_id:259) (Token id:Id.Lit_Chars val:'\t! (git ls-files | grep "\\\\.ig")\n' span_id:260) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'error out when attempting to add ignored ones without -f' span_id: 267 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:271) (Token id:Id.Lit_Chars val:'\ttest_must_fail git add a.?? &&\n' span_id:272) (Token id:Id.Lit_Chars val:'\t! (git ls-files | grep "\\\\.ig")\n' span_id:273) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'error out when attempting to add ignored ones without -f' span_id: 280 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:284) (Token id:Id.Lit_Chars val:'\ttest_must_fail git add d.?? &&\n' span_id:285) (Token id:Id.Lit_Chars val:'\t! (git ls-files | grep "\\\\.ig")\n' span_id:286) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'error out when attempting to add ignored ones but add others' span_id: 293 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:297) (Token id:Id.Lit_Chars val:'\ttouch a.if &&\n' span_id:298) (Token id:Id.Lit_Chars val:'\ttest_must_fail git add a.?? &&\n' span_id:299) (Token id: Id.Lit_Chars val: '\t! (git ls-files | grep "\\\\.ig") &&\n' span_id: 300 ) (Token id:Id.Lit_Chars val:'\t(git ls-files | grep a.if)\n' span_id:301) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'add ignored ones with -f' span_id:308))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:312) (Token id:Id.Lit_Chars val:'\tgit add -f a.?? &&\n' span_id:313) (Token id:Id.Lit_Chars val:'\tgit ls-files --error-unmatch a.ig\n' span_id:314) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'add ignored ones with -f' span_id:321))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:325) (Token id:Id.Lit_Chars val:'\tgit add -f d.??/* &&\n' span_id:326) (Token id:Id.Lit_Chars val:'\tgit ls-files --error-unmatch d.ig/d.if d.ig/d.ig\n' span_id:327) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'add ignored ones with -f' span_id:334))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:338) (Token id:Id.Lit_Chars val:'\trm -f .git/index &&\n' span_id:339) (Token id:Id.Lit_Chars val:'\tgit add -f d.?? &&\n' span_id:340) (Token id: Id.Lit_Chars val: '\tgit ls-files --error-unmatch d.ig/d.if d.ig/d.ig\n' span_id: 341 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'.gitignore with subdirectory' span_id:348))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:352) (Token id:Id.Lit_Chars val:'\n' span_id:353) (Token id:Id.Lit_Chars val:'\trm -f .git/index &&\n' span_id:354) (Token id:Id.Lit_Chars val:'\tmkdir -p sub/dir &&\n' span_id:355) (Token id:Id.Lit_Chars val:'\techo "!dir/a.*" >sub/.gitignore &&\n' span_id:356) (Token id:Id.Lit_Chars val:'\t>sub/a.ig &&\n' span_id:357) (Token id:Id.Lit_Chars val:'\t>sub/dir/a.ig &&\n' span_id:358) (Token id:Id.Lit_Chars val:'\tgit add sub/dir &&\n' span_id:359) (Token id: Id.Lit_Chars val: '\tgit ls-files --error-unmatch sub/dir/a.ig &&\n' span_id: 360 ) (Token id:Id.Lit_Chars val:'\trm -f .git/index &&\n' span_id:361) (Token id:Id.Lit_Chars val:'\t(\n' span_id:362) (Token id:Id.Lit_Chars val:'\t\tcd sub/dir &&\n' span_id:363) (Token id:Id.Lit_Chars val:'\t\tgit add .\n' span_id:364) (Token id:Id.Lit_Chars val:'\t) &&\n' span_id:365) (Token id: Id.Lit_Chars val: '\tgit ls-files --error-unmatch sub/dir/a.ig\n' span_id: 366 ) ) } ) (C {(mkdir)} {(1)} {(1/2)} {(1/3)}) (C {(touch)} {(1/2/a)} {(1/3/b)} {(1/2/c)}) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'check correct prefix detection' span_id:389))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:393) (Token id:Id.Lit_Chars val:'\trm -f .git/index &&\n' span_id:394) (Token id:Id.Lit_Chars val:'\tgit add 1/2/a 1/3/b 1/2/c\n' span_id:395) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'git add with filemode=0, symlinks=0, and unmerged entries' span_id: 402 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:406) (Token id:Id.Lit_Chars val:'\tfor s in 1 2 3\n' span_id:407) (Token id:Id.Lit_Chars val:'\tdo\n' span_id:408) (Token id:Id.Lit_Chars val:'\t\techo $s > stage$s\n' span_id:409) (Token id:Id.Lit_Chars val:'\t\techo "100755 $(git hash-object -w stage$s) $s\tfile"\n' span_id:410) (Token id: Id.Lit_Chars val: '\t\techo "120000 $(printf $s | git hash-object -w -t blob --stdin) $s\tsymlink"\n' span_id: 411 ) (Token id:Id.Lit_Chars val:'\tdone | git update-index --index-info &&\n' span_id:412) (Token id:Id.Lit_Chars val:'\tgit config core.filemode 0 &&\n' span_id:413) (Token id:Id.Lit_Chars val:'\tgit config core.symlinks 0 &&\n' span_id:414) (Token id:Id.Lit_Chars val:'\techo new > file &&\n' span_id:415) (Token id:Id.Lit_Chars val:'\techo new > symlink &&\n' span_id:416) (Token id:Id.Lit_Chars val:'\tgit add file symlink &&\n' span_id:417) (Token id:Id.Lit_Chars val:'\tgit ls-files --stage | grep "^100755 .* 0\tfile$" &&\n' span_id:418) (Token id: Id.Lit_Chars val: '\tgit ls-files --stage | grep "^120000 .* 0\tsymlink$"\n' span_id: 419 ) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'git add with filemode=0, symlinks=0 prefers stage 2 over stage 1' span_id: 426 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:430) (Token id:Id.Lit_Chars val:'\tgit rm --cached -f file symlink &&\n' span_id:431) (Token id:Id.Lit_Chars val:'\t(\n' span_id:432) (Token id: Id.Lit_Chars val: '\t\techo "100644 $(git hash-object -w stage1) 1\tfile"\n' span_id: 433 ) (Token id:Id.Lit_Chars val:'\t\techo "100755 $(git hash-object -w stage2) 2\tfile"\n' span_id:434) (Token id: Id.Lit_Chars val: '\t\techo "100644 $(printf 1 | git hash-object -w -t blob --stdin) 1\tsymlink"\n' span_id: 435 ) (Token id: Id.Lit_Chars val: '\t\techo "120000 $(printf 2 | git hash-object -w -t blob --stdin) 2\tsymlink"\n' span_id: 436 ) (Token id:Id.Lit_Chars val:'\t) | git update-index --index-info &&\n' span_id:437) (Token id:Id.Lit_Chars val:'\tgit config core.filemode 0 &&\n' span_id:438) (Token id:Id.Lit_Chars val:'\tgit config core.symlinks 0 &&\n' span_id:439) (Token id:Id.Lit_Chars val:'\techo new > file &&\n' span_id:440) (Token id:Id.Lit_Chars val:'\techo new > symlink &&\n' span_id:441) (Token id:Id.Lit_Chars val:'\tgit add file symlink &&\n' span_id:442) (Token id:Id.Lit_Chars val:'\tgit ls-files --stage | grep "^100755 .* 0\tfile$" &&\n' span_id:443) (Token id: Id.Lit_Chars val: '\tgit ls-files --stage | grep "^120000 .* 0\tsymlink$"\n' span_id: 444 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'git add --refresh' span_id:451))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:455) (Token id: Id.Lit_Chars val: '\t>foo && git add foo && git commit -a -m "commit all" &&\n' span_id: 456 ) (Token id:Id.Lit_Chars val:'\ttest -z "$(git diff-index HEAD -- foo)" &&\n' span_id:457) (Token id:Id.Lit_Chars val:'\tgit read-tree HEAD &&\n' span_id:458) (Token id:Id.Lit_Chars val:'\tcase "$(git diff-index HEAD -- foo)" in\n' span_id:459) (Token id:Id.Lit_Chars val:'\t:100644" "*"M\tfoo") echo pass;;\n' span_id:460) (Token id:Id.Lit_Chars val:'\t*) echo fail; (exit 1);;\n' span_id:461) (Token id:Id.Lit_Chars val:'\tesac &&\n' span_id:462) (Token id:Id.Lit_Chars val:'\tgit add --refresh -- foo &&\n' span_id:463) (Token id: Id.Lit_Chars val: '\ttest -z "$(git diff-index HEAD -- foo)"\n' span_id: 464 ) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'git add --refresh with pathspec' span_id:471))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:475) (Token id:Id.Lit_Chars val:'\tgit reset --hard &&\n' span_id:476) (Token id:Id.Lit_Chars val:'\techo >foo && echo >bar && echo >baz &&\n' span_id:477) (Token id: Id.Lit_Chars val: '\tgit add foo bar baz && H=$(git rev-parse :foo) && git rm -f foo &&\n' span_id: 478 ) (Token id: Id.Lit_Chars val: '\techo "100644 $H 3\tfoo" | git update-index --index-info &&\n' span_id: 479 ) (Token id:Id.Lit_Chars val:'\ttest-chmtime -60 bar baz &&\n' span_id:480) (Token id:Id.Lit_Chars val:'\t>expect &&\n' span_id:481) (Token id:Id.Lit_Chars val:'\tgit add --refresh bar >actual &&\n' span_id:482) (Token id:Id.Lit_Chars val:'\ttest_cmp expect actual &&\n' span_id:483) (Token id:Id.Lit_Chars val:'\n' span_id:484) (Token id: Id.Lit_Chars val: '\tgit diff-files --name-only >actual &&\n' span_id: 485 ) (Token id:Id.Lit_Chars val:'\t! grep bar actual&&\n' span_id:486) (Token id:Id.Lit_Chars val:'\tgrep baz actual\n' span_id:487) ) } ) (C {(test_expect_success)} {(POSIXPERM) (Id.Lit_Comma ',') (SANITY)} { (SQ (Token id: Id.Lit_Chars val: 'git add should fail atomically upon an unreadable file' span_id: 498 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:502) (Token id:Id.Lit_Chars val:'\tgit reset --hard &&\n' span_id:503) (Token id:Id.Lit_Chars val:'\tdate >foo1 &&\n' span_id:504) (Token id:Id.Lit_Chars val:'\tdate >foo2 &&\n' span_id:505) (Token id:Id.Lit_Chars val:'\tchmod 0 foo2 &&\n' span_id:506) (Token id: Id.Lit_Chars val: '\ttest_must_fail git add --verbose . &&\n' span_id: 507 ) (Token id:Id.Lit_Chars val:'\t! ( git ls-files foo1 | grep foo1 )\n' span_id:508) ) } ) (C {(rm)} {(-f)} {(foo2)}) (C {(test_expect_success)} {(POSIXPERM) (Id.Lit_Comma ',') (SANITY)} {(SQ (Token id:Id.Lit_Chars val:'git add --ignore-errors' span_id:526))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:530) (Token id:Id.Lit_Chars val:'\tgit reset --hard &&\n' span_id:531) (Token id:Id.Lit_Chars val:'\tdate >foo1 &&\n' span_id:532) (Token id:Id.Lit_Chars val:'\tdate >foo2 &&\n' span_id:533) (Token id:Id.Lit_Chars val:'\tchmod 0 foo2 &&\n' span_id:534) (Token id: Id.Lit_Chars val: '\ttest_must_fail git add --verbose --ignore-errors . &&\n' span_id: 535 ) (Token id:Id.Lit_Chars val:'\tgit ls-files foo1 | grep foo1\n' span_id:536) ) } ) (C {(rm)} {(-f)} {(foo2)}) (C {(test_expect_success)} {(POSIXPERM) (Id.Lit_Comma ',') (SANITY)} {(SQ (Token id:Id.Lit_Chars val:'git add (add.ignore-errors)' span_id:554))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:558) (Token id:Id.Lit_Chars val:'\tgit config add.ignore-errors 1 &&\n' span_id:559) (Token id:Id.Lit_Chars val:'\tgit reset --hard &&\n' span_id:560) (Token id:Id.Lit_Chars val:'\tdate >foo1 &&\n' span_id:561) (Token id:Id.Lit_Chars val:'\tdate >foo2 &&\n' span_id:562) (Token id:Id.Lit_Chars val:'\tchmod 0 foo2 &&\n' span_id:563) (Token id:Id.Lit_Chars val:'\ttest_must_fail git add --verbose . &&\n' span_id:564) (Token id:Id.Lit_Chars val:'\tgit ls-files foo1 | grep foo1\n' span_id:565) ) } ) (C {(rm)} {(-f)} {(foo2)}) (C {(test_expect_success)} {(POSIXPERM) (Id.Lit_Comma ',') (SANITY)} {(SQ (Token id:Id.Lit_Chars val:'git add (add.ignore-errors = false)' span_id:582))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:586) (Token id:Id.Lit_Chars val:'\tgit config add.ignore-errors 0 &&\n' span_id:587) (Token id:Id.Lit_Chars val:'\tgit reset --hard &&\n' span_id:588) (Token id:Id.Lit_Chars val:'\tdate >foo1 &&\n' span_id:589) (Token id:Id.Lit_Chars val:'\tdate >foo2 &&\n' span_id:590) (Token id:Id.Lit_Chars val:'\tchmod 0 foo2 &&\n' span_id:591) (Token id:Id.Lit_Chars val:'\ttest_must_fail git add --verbose . &&\n' span_id:592) (Token id:Id.Lit_Chars val:'\t! ( git ls-files foo1 | grep foo1 )\n' span_id:593) ) } ) (C {(rm)} {(-f)} {(foo2)}) (C {(test_expect_success)} {(POSIXPERM) (Id.Lit_Comma ',') (SANITY)} {(SQ (Token id:Id.Lit_Chars val:'--no-ignore-errors overrides config' span_id:610))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:614) (Token id: Id.Lit_Chars val: ' git config add.ignore-errors 1 &&\n' span_id: 615 ) (Token id:Id.Lit_Chars val:' git reset --hard &&\n' span_id:616) (Token id:Id.Lit_Chars val:' date >foo1 &&\n' span_id:617) (Token id:Id.Lit_Chars val:' date >foo2 &&\n' span_id:618) (Token id:Id.Lit_Chars val:' chmod 0 foo2 &&\n' span_id:619) (Token id: Id.Lit_Chars val: ' test_must_fail git add --verbose --no-ignore-errors . &&\n' span_id: 620 ) (Token id:Id.Lit_Chars val:' ! ( git ls-files foo1 | grep foo1 ) &&\n' span_id:621) (Token id:Id.Lit_Chars val:' git config add.ignore-errors 0\n' span_id:622) ) } ) (C {(rm)} {(-f)} {(foo2)}) (C {(test_expect_success)} {(BSLASHPSPEC)} { (DQ ("git add 'fo") (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\\\' span_id:638) ) ('[ou') (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\\\' span_id:640)) ("]bar' ignores foobar") ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:645) (Token id:Id.Lit_Chars val:'\tgit reset --hard &&\n' span_id:646) (Token id:Id.Lit_Chars val:'\ttouch fo\\[ou\\]bar foobar &&\n' span_id:647) (Token id:Id.Lit_Chars val:'\tgit add ' span_id:648) ) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:"\\'" span_id:650)) (SQ (Token id:Id.Lit_Chars val:'fo\\[ou\\]bar' span_id:652)) (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:"\\'" span_id:654)) (SQ (Token id:Id.Lit_Chars val:' &&\n' span_id:656) (Token id: Id.Lit_Chars val: '\tgit ls-files fo\\[ou\\]bar | fgrep fo\\[ou\\]bar &&\n' span_id: 657 ) (Token id:Id.Lit_Chars val:'\t! ( git ls-files foobar | grep foobar )\n' span_id:658) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'git add to resolve conflicts on otherwise ignored path' span_id: 665 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:669) (Token id:Id.Lit_Chars val:'\tgit reset --hard &&\n' span_id:670) (Token id:Id.Lit_Chars val:'\tH=$(git rev-parse :1/2/a) &&\n' span_id:671) (Token id:Id.Lit_Chars val:'\t(\n' span_id:672) (Token id:Id.Lit_Chars val:'\t\techo "100644 $H 1\ttrack-this"\n' span_id:673) (Token id:Id.Lit_Chars val:'\t\techo "100644 $H 3\ttrack-this"\n' span_id:674) (Token id:Id.Lit_Chars val:'\t) | git update-index --index-info &&\n' span_id:675) (Token id:Id.Lit_Chars val:'\techo track-this >>.gitignore &&\n' span_id:676) (Token id:Id.Lit_Chars val:'\techo resolved >track-this &&\n' span_id:677) (Token id:Id.Lit_Chars val:'\tgit add track-this\n' span_id:678) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'"add non-existent" should fail' span_id:685))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:689) (Token id: Id.Lit_Chars val: '\ttest_must_fail git add non-existent &&\n' span_id: 690 ) (Token id:Id.Lit_Chars val:'\t! (git ls-files | grep "non-existent")\n' span_id:691) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'git add -A on empty repo does not error out' span_id:698))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:702) (Token id:Id.Lit_Chars val:'\trm -fr empty &&\n' span_id:703) (Token id:Id.Lit_Chars val:'\tgit init empty &&\n' span_id:704) (Token id:Id.Lit_Chars val:'\t(\n' span_id:705) (Token id:Id.Lit_Chars val:'\t\tcd empty &&\n' span_id:706) (Token id:Id.Lit_Chars val:'\t\tgit add -A . &&\n' span_id:707) (Token id:Id.Lit_Chars val:'\t\tgit add -A\n' span_id:708) (Token id:Id.Lit_Chars val:'\t)\n' span_id:709) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'"git add ." in empty repo' span_id:716))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:720) (Token id:Id.Lit_Chars val:'\trm -fr empty &&\n' span_id:721) (Token id:Id.Lit_Chars val:'\tgit init empty &&\n' span_id:722) (Token id:Id.Lit_Chars val:'\t(\n' span_id:723) (Token id:Id.Lit_Chars val:'\t\tcd empty &&\n' span_id:724) (Token id:Id.Lit_Chars val:'\t\tgit add .\n' span_id:725) (Token id:Id.Lit_Chars val:'\t)\n' span_id:726) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'git add --dry-run of existing changed file' span_id:733))} { (DQ ('\n') ('\techo new >>track-this &&\n') ('\tgit add --dry-run track-this >actual 2>&1 &&\n') ('\techo ') (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:741)) ("add 'track-this'") (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:743)) (' | test_cmp - actual\n') ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'git add --dry-run of non-existing file' span_id:751))} { (DQ ('\n') ('\techo ignored-file >>.gitignore &&\n') ('\ttest_must_fail git add --dry-run track-this ignored-file >actual 2>&1\n') ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'git add --dry-run of an existing file output' span_id:764))} { (DQ ('\n') ('\techo ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:770) ) ("fatal: pathspec 'ignored-file' did not match any files") (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:772) ) (' >expect &&\n') ('\ttest_i18ncmp expect actual\n') ) } ) (command.Simple words: [{(cat)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:780) fd: -1 arg_word: {(expect.err)} ) (redir.HereDoc op: (Token id:Id.Redir_DLess val:'<<' span_id:783) fd: -1 here_begin: {(word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\E' span_id:784)) (OF) } here_end_span_id: 790 stdin_parts: [ ('The following paths are ignored by one of your .gitignore files:\n') ('ignored-file\n') ('Use -f if you really want to add them.\n') ] ) ] ) (command.Simple words: [{(cat)}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:793) fd: -1 arg_word: {(expect.out)} ) (redir.HereDoc op: (Token id:Id.Redir_DLess val:'<<' span_id:796) fd: -1 here_begin: {(word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\E' span_id:797)) (OF) } here_end_span_id: 801 stdin_parts: [("add 'track-this'\n")] ) ] ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'git add --dry-run --ignore-missing of non-existing file' span_id: 806 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:810) (Token id: Id.Lit_Chars val: '\ttest_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual.out 2>actual.err\n' span_id: 811 ) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'git add --dry-run --ignore-missing of non-existing file output' span_id: 818 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:822) (Token id: Id.Lit_Chars val: '\ttest_i18ncmp expect.out actual.out &&\n' span_id: 823 ) (Token id:Id.Lit_Chars val:'\ttest_i18ncmp expect.err actual.err\n' span_id:824) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'git add empty string should invoke warning' span_id:831))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:835) (Token id:Id.Lit_Chars val:'\tgit add "" 2>output &&\n' span_id:836) (Token id:Id.Lit_Chars val:'\ttest_i18ngrep "warning: empty strings" output\n' span_id:837) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'git add --chmod=[+-]x stages correctly' span_id:844))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:848) (Token id:Id.Lit_Chars val:'\trm -f foo1 &&\n' span_id:849) (Token id:Id.Lit_Chars val:'\techo foo >foo1 &&\n' span_id:850) (Token id:Id.Lit_Chars val:'\tgit add --chmod=+x foo1 &&\n' span_id:851) (Token id:Id.Lit_Chars val:'\ttest_mode_in_index 100755 foo1 &&\n' span_id:852) (Token id:Id.Lit_Chars val:'\tgit add --chmod=-x foo1 &&\n' span_id:853) (Token id:Id.Lit_Chars val:'\ttest_mode_in_index 100644 foo1\n' span_id:854) ) } ) (C {(test_expect_success)} {(POSIXPERM) (Id.Lit_Comma ',') (SYMLINKS)} {(SQ (Token id:Id.Lit_Chars val:'git add --chmod=+x with symlinks' span_id:865))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:869) (Token id:Id.Lit_Chars val:'\tgit config core.filemode 1 &&\n' span_id:870) (Token id:Id.Lit_Chars val:'\tgit config core.symlinks 1 &&\n' span_id:871) (Token id:Id.Lit_Chars val:'\trm -f foo2 &&\n' span_id:872) (Token id:Id.Lit_Chars val:'\techo foo >foo2 &&\n' span_id:873) (Token id:Id.Lit_Chars val:'\tgit add --chmod=+x foo2 &&\n' span_id:874) (Token id:Id.Lit_Chars val:'\ttest_mode_in_index 100755 foo2\n' span_id:875) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'git add --chmod=[+-]x changes index with already added file' span_id: 882 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:886) (Token id:Id.Lit_Chars val:'\trm -f foo3 xfoo3 &&\n' span_id:887) (Token id:Id.Lit_Chars val:'\techo foo >foo3 &&\n' span_id:888) (Token id:Id.Lit_Chars val:'\tgit add foo3 &&\n' span_id:889) (Token id:Id.Lit_Chars val:'\tgit add --chmod=+x foo3 &&\n' span_id:890) (Token id:Id.Lit_Chars val:'\ttest_mode_in_index 100755 foo3 &&\n' span_id:891) (Token id:Id.Lit_Chars val:'\techo foo >xfoo3 &&\n' span_id:892) (Token id:Id.Lit_Chars val:'\tchmod 755 xfoo3 &&\n' span_id:893) (Token id:Id.Lit_Chars val:'\tgit add xfoo3 &&\n' span_id:894) (Token id:Id.Lit_Chars val:'\tgit add --chmod=-x xfoo3 &&\n' span_id:895) (Token id:Id.Lit_Chars val:'\ttest_mode_in_index 100644 xfoo3\n' span_id:896) ) } ) (C {(test_expect_success)} {(POSIXPERM)} { (SQ (Token id: Id.Lit_Chars val: 'git add --chmod=[+-]x does not change the working tree' span_id: 905 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:909) (Token id:Id.Lit_Chars val:'\techo foo >foo4 &&\n' span_id:910) (Token id:Id.Lit_Chars val:'\tgit add foo4 &&\n' span_id:911) (Token id:Id.Lit_Chars val:'\tgit add --chmod=+x foo4 &&\n' span_id:912) (Token id:Id.Lit_Chars val:'\t! test -x foo4\n' span_id:913) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'no file status change if no pathspec is given' span_id:920))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:924) (Token id:Id.Lit_Chars val:'\t>foo5 &&\n' span_id:925) (Token id:Id.Lit_Chars val:'\t>foo6 &&\n' span_id:926) (Token id:Id.Lit_Chars val:'\tgit add foo5 foo6 &&\n' span_id:927) (Token id:Id.Lit_Chars val:'\tgit add --chmod=+x &&\n' span_id:928) (Token id:Id.Lit_Chars val:'\ttest_mode_in_index 100644 foo5 &&\n' span_id:929) (Token id:Id.Lit_Chars val:'\ttest_mode_in_index 100644 foo6\n' span_id:930) ) } ) (C {(test_expect_success)} { (SQ (Token id: Id.Lit_Chars val: 'no file status change if no pathspec is given in subdir' span_id: 937 ) ) } { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:941) (Token id:Id.Lit_Chars val:'\tmkdir -p sub &&\n' span_id:942) (Token id:Id.Lit_Chars val:'\t(\n' span_id:943) (Token id:Id.Lit_Chars val:'\t\tcd sub &&\n' span_id:944) (Token id:Id.Lit_Chars val:'\t\t>sub-foo1 &&\n' span_id:945) (Token id:Id.Lit_Chars val:'\t\t>sub-foo2 &&\n' span_id:946) (Token id:Id.Lit_Chars val:'\t\tgit add . &&\n' span_id:947) (Token id:Id.Lit_Chars val:'\t\tgit add --chmod=+x &&\n' span_id:948) (Token id:Id.Lit_Chars val:'\t\ttest_mode_in_index 100644 sub-foo1 &&\n' span_id:949) (Token id: Id.Lit_Chars val: '\t\ttest_mode_in_index 100644 sub-foo2\n' span_id: 950 ) (Token id:Id.Lit_Chars val:'\t)\n' span_id:951) ) } ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:'all statuses changed in folder if . is given' span_id:958))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:962) (Token id:Id.Lit_Chars val:'\tgit add --chmod=+x . &&\n' span_id:963) (Token id: Id.Lit_Chars val: '\ttest $(git ls-files --stage | grep ^100644 | wc -l) -eq 0 &&\n' span_id: 964 ) (Token id:Id.Lit_Chars val:'\tgit add --chmod=-x . &&\n' span_id:965) (Token id: Id.Lit_Chars val: '\ttest $(git ls-files --stage | grep ^100755 | wc -l) -eq 0\n' span_id: 966 ) ) } ) (C {(test_done)}) ] )