(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"test git fast-import utility">)} spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (Sentence child: (C {(.)} {(DQ ($ VSub_Name "$TEST_DIRECTORY")) (/diff-lib.sh)}) terminator: <Op_Semi ";"> ) (FuncDef name: verify_packs body: (BraceGroup children: [ (ForEach iter_name: p iter_words: [{(.git/objects/pack/) (Lit_Other "*") (.pack)}] do_arg_iter: False body: (DoGroup children: [ (AndOr children: [ (C {(git)} {(verify-pack)} {(DQ ($ VSub_At "$@"))} {(DQ ($ VSub_Name "$p"))}) (ControlFlow token:<ControlFlow_Return return>) ] op_id: Op_DPipe ) ] spids: [53 73] ) spids: [47 -1] ) ] spids: [39] ) spids: [34 38] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:file2_data) op: Equal rhs: {(SQ <"file2\n"> <"second line of EOF">)} spids: [78] ) ] spids: [78] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:file3_data) op: Equal rhs: {(SQ <"EOF\n"> <"in 3rd file\n"> <" END">)} spids: [85] ) ] spids: [85] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:file4_data) op:Equal rhs:{(abcd)} spids:[93])] spids: [93] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:file4_len) op:Equal rhs:{(4)} spids:[96])] spids: [96] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:file5_data) op: Equal rhs: {(SQ <"an inline file.\n"> <" we should see it later.">)} spids: [100] ) ] spids: [100] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:file6_data) op: Equal rhs: {(SQ <"#!/bin/sh\n"> <"echo \"$@\"">)} spids: [107] ) ] spids: [107] ) (C {(test_expect_success)} {(SQ <"empty stream succeeds">)} {(SQ <"\n"> <"\tgit config fastimport.unpackLimit 0 &&\n"> <"\tgit fast-import </dev/null\n">)} ) (C {(test_expect_success)} {(SQ <"truncated stream complains">)} {(SQ <"\n"> <"\techo \"tag foo\" | test_must_fail git fast-import\n">)} ) (C {(test_expect_success)} {(SQ <"A: create pack from stdin">)} { (SQ <"\n"> <"\ttest_tick &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tblob\n"> <"\tmark :2\n"> <"\tdata <<EOF\n"> <"\t$file2_data\n"> <"\tEOF\n"> <"\n"> <"\tblob\n"> <"\tmark :3\n"> <"\tdata <<END\n"> <"\t$file3_data\n"> <"\tEND\n"> <"\n"> <"\tblob\n"> <"\tmark :4\n"> <"\tdata $file4_len\n"> <"\t$file4_data\n"> <"\tcommit refs/heads/master\n"> <"\tmark :5\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tinitial\n"> <"\tCOMMIT\n"> <"\n"> <"\tM 644 :2 file2\n"> <"\tM 644 :3 file3\n"> <"\tM 755 :4 file4\n"> <"\n"> <"\ttag series-A\n"> <"\tfrom :5\n"> <"\tdata <<EOF\n"> <"\tAn annotated tag without a tagger\n"> <"\tEOF\n"> <"\n"> <"\ttag series-A-blob\n"> <"\tfrom :3\n"> <"\tdata <<EOF\n"> <"\tAn annotated tag that annotates a blob.\n"> <"\tEOF\n"> <"\n"> <"\tINPUT_END\n"> <"\tgit fast-import --export-marks=marks.out <input &&\n"> <"\tgit whatchanged master\n"> ) } ) (C {(test_expect_success)} {(SQ <"A: verify pack">)} {(SQ <"\n"> <"\tverify_packs\n">)}) (C {(test_expect_success)} {(SQ <"A: verify commit">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\n"> <"\tinitial\n"> <"\tEOF\n"> <"\tgit cat-file commit master | sed 1d >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"A: verify tree">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t100644 blob file2\n"> <"\t100644 blob file3\n"> <"\t100755 blob file4\n"> <"\tEOF\n"> <"\tgit cat-file -p master^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"A: verify file2">)} { (SQ <"\n"> <"\techo \"$file2_data\" >expect &&\n"> <"\tgit cat-file blob master:file2 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"A: verify file3">)} { (SQ <"\n"> <"\techo \"$file3_data\" >expect &&\n"> <"\tgit cat-file blob master:file3 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"A: verify file4">)} { (SQ <"\n"> <"\tprintf \"$file4_data\" >expect &&\n"> <"\tgit cat-file blob master:file4 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"A: verify tag/series-A">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\tobject $(git rev-parse refs/heads/master)\n"> <"\ttype commit\n"> <"\ttag series-A\n"> <"\n"> <"\tAn annotated tag without a tagger\n"> <"\tEOF\n"> <"\tgit cat-file tag tags/series-A >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"A: verify tag/series-A-blob">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\tobject $(git rev-parse refs/heads/master:file3)\n"> <"\ttype blob\n"> <"\ttag series-A-blob\n"> <"\n"> <"\tAn annotated tag that annotates a blob.\n"> <"\tEOF\n"> <"\tgit cat-file tag tags/series-A-blob >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"A: verify marks output">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t:2 $(git rev-parse --verify master:file2)\n"> <"\t:3 $(git rev-parse --verify master:file3)\n"> <"\t:4 $(git rev-parse --verify master:file4)\n"> <"\t:5 $(git rev-parse --verify master^0)\n"> <"\tEOF\n"> <"\ttest_cmp expect marks.out\n"> ) } ) (C {(test_expect_success)} {(SQ <"A: verify marks import">)} { (SQ <"\n"> <"\tgit fast-import \\\n"> <"\t\t--import-marks=marks.out \\\n"> <"\t\t--export-marks=marks.new \\\n"> <"\t\t</dev/null &&\n"> <"\ttest_cmp expect marks.new\n"> ) } ) (C {(test_expect_success)} {(SQ <"A: tag blob by sha1">)} { (SQ <"\n"> <"\ttest_tick &&\n"> <"\tnew_blob=$(echo testing | git hash-object --stdin) &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\ttag series-A-blob-2\n"> <"\tfrom $(git rev-parse refs/heads/master:file3)\n"> <"\tdata <<EOF\n"> <"\tTag blob by sha1.\n"> <"\tEOF\n"> <"\n"> <"\tblob\n"> <"\tmark :6\n"> <"\tdata <<EOF\n"> <"\ttesting\n"> <"\tEOF\n"> <"\n"> <"\tcommit refs/heads/new_blob\n"> <"\tcommitter <> 0 +0000\n"> <"\tdata 0\n"> <"\tM 644 :6 new_blob\n"> <"\t#pretend we got sha1 from fast-import\n"> <"\tls \"new_blob\"\n"> <"\n"> <"\ttag series-A-blob-3\n"> <"\tfrom $new_blob\n"> <"\tdata <<EOF\n"> <"\tTag new_blob.\n"> <"\tEOF\n"> <"\tINPUT_END\n"> <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\tobject $(git rev-parse refs/heads/master:file3)\n"> <"\ttype blob\n"> <"\ttag series-A-blob-2\n"> <"\n"> <"\tTag blob by sha1.\n"> <"\tobject $new_blob\n"> <"\ttype blob\n"> <"\ttag series-A-blob-3\n"> <"\n"> <"\tTag new_blob.\n"> <"\tEOF\n"> <"\n"> <"\tgit fast-import <input &&\n"> <"\tgit cat-file tag tags/series-A-blob-2 >actual &&\n"> <"\tgit cat-file tag tags/series-A-blob-3 >>actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"A: verify marks import does not crash">)} { (SQ <"\n"> <"\ttest_tick &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/verify--import-marks\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\trecreate from :5\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom :5\n"> <"\tM 755 :2 copy-of-file2\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tgit fast-import --import-marks=marks.out <input &&\n"> <"\tgit whatchanged verify--import-marks\n"> ) } ) (C {(test_expect_success)} {(SQ <"A: verify pack">)} {(SQ <"\n"> <"\tverify_packs\n">)}) (C {(test_expect_success)} {(SQ <"A: verify diff">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> < "\t:000000 100755 0000000000000000000000000000000000000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 A\tcopy-of-file2\n" > <"\tEOF\n"> <"\tgit diff-tree -M -r master verify--import-marks >actual &&\n"> <"\tcompare_diff_raw expect actual &&\n"> <"\ttest $(git rev-parse --verify master:file2) \\\n"> <"\t = $(git rev-parse --verify verify--import-marks:copy-of-file2)\n"> ) } ) (C {(test_expect_success)} {(SQ <"A: export marks with large values">)} { (SQ <"\n"> <"\ttest_tick &&\n"> <"\tmt=$(git hash-object --stdin < /dev/null) &&\n"> <"\t>input.blob &&\n"> <"\t>marks.exp &&\n"> <"\t>tree.exp &&\n"> <"\n"> <"\tcat >input.commit <<-EOF &&\n"> <"\tcommit refs/heads/verify--dump-marks\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\ttest the sparse array dumping routines with exponentially growing marks\n"> <"\tCOMMIT\n"> <"\tEOF\n"> <"\n"> <"\ti=0 l=4 m=6 n=7 &&\n"> <"\twhile test \"$i\" -lt 27\n"> <"\tdo\n"> <"\t\tcat >>input.blob <<-EOF &&\n"> <"\t\tblob\n"> <"\t\tmark :$l\n"> <"\t\tdata 0\n"> <"\t\tblob\n"> <"\t\tmark :$m\n"> <"\t\tdata 0\n"> <"\t\tblob\n"> <"\t\tmark :$n\n"> <"\t\tdata 0\n"> <"\t\tEOF\n"> <"\t\techo \"M 100644 :$l l$i\" >>input.commit &&\n"> <"\t\techo \"M 100644 :$m m$i\" >>input.commit &&\n"> <"\t\techo \"M 100644 :$n n$i\" >>input.commit &&\n"> <"\n"> <"\t\techo \":$l $mt\" >>marks.exp &&\n"> <"\t\techo \":$m $mt\" >>marks.exp &&\n"> <"\t\techo \":$n $mt\" >>marks.exp &&\n"> <"\n"> <"\t\tprintf \"100644 blob $mt\\tl$i\\n\" >>tree.exp &&\n"> <"\t\tprintf \"100644 blob $mt\\tm$i\\n\" >>tree.exp &&\n"> <"\t\tprintf \"100644 blob $mt\\tn$i\\n\" >>tree.exp &&\n"> <"\n"> <"\t\tl=$(($l + $l)) &&\n"> <"\t\tm=$(($m + $m)) &&\n"> <"\t\tn=$(($l + $n)) &&\n"> <"\n"> <"\t\ti=$((1 + $i)) || return 1\n"> <"\tdone &&\n"> <"\n"> <"\tsort tree.exp > tree.exp_s &&\n"> <"\n"> <"\tcat input.blob input.commit | git fast-import --export-marks=marks.large &&\n"> <"\tgit ls-tree refs/heads/verify--dump-marks >tree.out &&\n"> <"\ttest_cmp tree.exp_s tree.out &&\n"> <"\ttest_cmp marks.exp marks.large\n"> ) } ) (C {(test_expect_success)} {(SQ <"B: fail on invalid blob sha1">)} { (SQ <"\n"> <"\ttest_tick &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/branch\n"> <"\tmark :1\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcorrupt\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/master\n"> <"\tM 755 0000000000000000000000000000000000000001 zero1\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\ttest_when_finished \"rm -f .git/objects/pack_* .git/objects/index_*\" &&\n"> <"\ttest_must_fail git fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"B: accept branch name \"TEMP_TAG\"">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit TEMP_TAG\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\ttag base\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/master\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\ttest_when_finished \"rm -f .git/TEMP_TAG\n"> <"\t\tgit gc\n"> <"\t\tgit prune\" &&\n"> <"\tgit fast-import <input &&\n"> <"\ttest -f .git/TEMP_TAG &&\n"> <"\ttest $(git rev-parse master) = $(git rev-parse TEMP_TAG^)\n"> ) } ) (C {(test_expect_success)} {(SQ <"B: accept empty committer">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/empty-committer-1\n"> <"\tcommitter <> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tempty commit\n"> <"\tCOMMIT\n"> <"\tINPUT_END\n"> <"\n"> <"\ttest_when_finished \"git update-ref -d refs/heads/empty-committer-1\n"> <"\t\tgit gc\n"> <"\t\tgit prune\" &&\n"> <"\tgit fast-import <input &&\n"> <"\tout=$(git fsck) &&\n"> <"\techo \"$out\" &&\n"> <"\ttest -z \"$out\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"B: accept and fixup committer with no name">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/empty-committer-2\n"> <"\tcommitter <a@b.com> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tempty commit\n"> <"\tCOMMIT\n"> <"\tINPUT_END\n"> <"\n"> <"\ttest_when_finished \"git update-ref -d refs/heads/empty-committer-2\n"> <"\t\tgit gc\n"> <"\t\tgit prune\" &&\n"> <"\tgit fast-import <input &&\n"> <"\tout=$(git fsck) &&\n"> <"\techo \"$out\" &&\n"> <"\ttest -z \"$out\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"B: fail on invalid committer (1)">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/invalid-committer\n"> <"\tcommitter Name email> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tempty commit\n"> <"\tCOMMIT\n"> <"\tINPUT_END\n"> <"\n"> <"\ttest_when_finished \"git update-ref -d refs/heads/invalid-committer\" &&\n"> <"\ttest_must_fail git fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"B: fail on invalid committer (2)">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/invalid-committer\n"> <"\tcommitter Name <e<mail> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tempty commit\n"> <"\tCOMMIT\n"> <"\tINPUT_END\n"> <"\n"> <"\ttest_when_finished \"git update-ref -d refs/heads/invalid-committer\" &&\n"> <"\ttest_must_fail git fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"B: fail on invalid committer (3)">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/invalid-committer\n"> <"\tcommitter Name <email>> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tempty commit\n"> <"\tCOMMIT\n"> <"\tINPUT_END\n"> <"\n"> <"\ttest_when_finished \"git update-ref -d refs/heads/invalid-committer\" &&\n"> <"\ttest_must_fail git fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"B: fail on invalid committer (4)">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/invalid-committer\n"> <"\tcommitter Name <email $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tempty commit\n"> <"\tCOMMIT\n"> <"\tINPUT_END\n"> <"\n"> <"\ttest_when_finished \"git update-ref -d refs/heads/invalid-committer\" &&\n"> <"\ttest_must_fail git fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"B: fail on invalid committer (5)">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/invalid-committer\n"> <"\tcommitter Name<email> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tempty commit\n"> <"\tCOMMIT\n"> <"\tINPUT_END\n"> <"\n"> <"\ttest_when_finished \"git update-ref -d refs/heads/invalid-committer\" &&\n"> <"\ttest_must_fail git fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"C: incremental import create pack from stdin">)} { (SQ <"\n"> <"\tnewf=$(echo hi newf | git hash-object -w --stdin) &&\n"> <"\toldf=$(git rev-parse --verify master:file2) &&\n"> <"\ttest_tick &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/branch\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tsecond\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/master\n"> <"\tM 644 $oldf file2/oldf\n"> <"\tM 755 $newf file2/newf\n"> <"\tD file3\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tgit fast-import <input &&\n"> <"\tgit whatchanged branch\n"> ) } ) (C {(test_expect_success)} {(SQ <"C: verify pack">)} {(SQ <"\n"> <"\tverify_packs\n">)}) (C {(test_expect_success)} {(SQ <"C: validate reuse existing blob">)} { (SQ <"\n"> <"\ttest $newf = $(git rev-parse --verify branch:file2/newf) &&\n"> <"\ttest $oldf = $(git rev-parse --verify branch:file2/oldf)\n"> ) } ) (C {(test_expect_success)} {(SQ <"C: verify commit">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\tparent $(git rev-parse --verify master^0)\n"> <"\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\n"> <"\tsecond\n"> <"\tEOF\n"> <"\n"> <"\tgit cat-file commit branch | sed 1d >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"C: validate rename result">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> < "\t:000000 100755 0000000000000000000000000000000000000000 f1fb5da718392694d0076d677d6d0e364c79b0bc A\tfile2/newf\n" > < "\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100\tfile2\tfile2/oldf\n" > < "\t:100644 000000 0d92e9f3374ae2947c23aa477cbc68ce598135f1 0000000000000000000000000000000000000000 D\tfile3\n" > <"\tEOF\n"> <"\tgit diff-tree -M -r master branch >actual &&\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"D: inline data in commit">)} { (SQ <"\n"> <"\ttest_tick &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/branch\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tthird\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^0\n"> <"\tM 644 inline newdir/interesting\n"> <"\tdata <<EOF\n"> <"\t$file5_data\n"> <"\tEOF\n"> <"\n"> <"\tM 755 inline newdir/exec.sh\n"> <"\tdata <<EOF\n"> <"\t$file6_data\n"> <"\tEOF\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tgit fast-import <input &&\n"> <"\tgit whatchanged branch\n"> ) } ) (C {(test_expect_success)} {(SQ <"D: verify pack">)} {(SQ <"\n"> <"\tverify_packs\n">)}) (C {(test_expect_success)} {(SQ <"D: validate new files added">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> < "\t:000000 100755 0000000000000000000000000000000000000000 e74b7d465e52746be2b4bae983670711e6e66657 A\tnewdir/exec.sh\n" > < "\t:000000 100644 0000000000000000000000000000000000000000 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 A\tnewdir/interesting\n" > <"\tEOF\n"> <"\tgit diff-tree -M -r branch^ branch >actual &&\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"D: verify file5">)} { (SQ <"\n"> <"\techo \"$file5_data\" >expect &&\n"> <"\tgit cat-file blob branch:newdir/interesting >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"D: verify file6">)} { (SQ <"\n"> <"\techo \"$file6_data\" >expect &&\n"> <"\tgit cat-file blob branch:newdir/exec.sh >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"E: rfc2822 date, --date-format=raw">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/branch\n"> <"\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> Tue Feb 6 11:22:18 2007 -0500\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500\n"> <"\tdata <<COMMIT\n"> <"\tRFC 2822 type date\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^0\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\ttest_must_fail git fast-import --date-format=raw <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"E: rfc2822 date, --date-format=rfc2822">)} {(SQ <"\n"> <"\tgit fast-import --date-format=rfc2822 <input\n">)} ) (C {(test_expect_success)} {(SQ <"E: verify pack">)} {(SQ <"\n"> <"\tverify_packs\n">)}) (C {(test_expect_success)} {(SQ <"E: verify commit">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\tauthor $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 1170778938 -0500\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500\n"> <"\n"> <"\tRFC 2822 type date\n"> <"\tEOF\n"> <"\tgit cat-file commit branch | sed 1,2d >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"F: non-fast-forward update skips">)} { (SQ <"\n"> <"\told_branch=$(git rev-parse --verify branch^0) &&\n"> <"\ttest_tick &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/branch\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tlosing things already?\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch~1\n"> <"\n"> <"\treset refs/heads/other\n"> <"\tfrom refs/heads/branch\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\ttest_must_fail git fast-import <input &&\n"> <"\t# branch must remain unaffected\n"> <"\ttest $old_branch = $(git rev-parse --verify branch^0)\n"> ) } ) (C {(test_expect_success)} {(SQ <"F: verify pack">)} {(SQ <"\n"> <"\tverify_packs\n">)}) (C {(test_expect_success)} {(SQ <"F: verify other commit">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\ttree $(git rev-parse branch~1^{tree})\n"> <"\tparent $(git rev-parse branch~1)\n"> <"\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\n"> <"\tlosing things already?\n"> <"\tEOF\n"> <"\tgit cat-file commit other >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"G: non-fast-forward update forced">)} { (SQ <"\n"> <"\told_branch=$(git rev-parse --verify branch^0) &&\n"> <"\ttest_tick &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/branch\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tlosing things already?\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch~1\n"> <"\n"> <"\tINPUT_END\n"> <"\tgit fast-import --force <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"G: verify pack">)} {(SQ <"\n"> <"\tverify_packs\n">)}) (C {(test_expect_success)} {(SQ <"G: branch changed, but logged">)} { (SQ <"\n"> <"\ttest $old_branch != $(git rev-parse --verify branch^0) &&\n"> <"\ttest $old_branch = $(git rev-parse --verify branch@{1})\n"> ) } ) (C {(test_expect_success)} {(SQ <"H: deletall, add 1">)} { (SQ <"\n"> <"\ttest_tick &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/H\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tthird\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^0\n"> <"\tM 644 inline i-will-die\n"> <"\tdata <<EOF\n"> <"\tthis file will never exist.\n"> <"\tEOF\n"> <"\n"> <"\tdeleteall\n"> <"\tM 644 inline h/e/l/lo\n"> <"\tdata <<EOF\n"> <"\t$file5_data\n"> <"\tEOF\n"> <"\n"> <"\tINPUT_END\n"> <"\tgit fast-import <input &&\n"> <"\tgit whatchanged H\n"> ) } ) (C {(test_expect_success)} {(SQ <"H: verify pack">)} {(SQ <"\n"> <"\tverify_packs\n">)}) (C {(test_expect_success)} {(SQ <"H: validate old files removed, new files added">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> < "\t:100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D\tfile2/newf\n" > < "\t:100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D\tfile2/oldf\n" > < "\t:100755 000000 85df50785d62d3b05ab03d9cbf7e4a0b49449730 0000000000000000000000000000000000000000 D\tfile4\n" > < "\t:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100\tnewdir/interesting\th/e/l/lo\n" > < "\t:100755 000000 e74b7d465e52746be2b4bae983670711e6e66657 0000000000000000000000000000000000000000 D\tnewdir/exec.sh\n" > <"\tEOF\n"> <"\tgit diff-tree -M -r H^ H >actual &&\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"H: verify file">)} { (SQ <"\n"> <"\techo \"$file5_data\" >expect &&\n"> <"\tgit cat-file blob H:h/e/l/lo >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"I: export-pack-edges">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/export-boundary\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\twe have a border. its only 40 characters wide.\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch\n"> <"\n"> <"\tINPUT_END\n"> <"\tgit fast-import --export-pack-edges=edges.list <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"I: verify edge list">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\t.git/objects/pack/pack-.pack: $(git rev-parse --verify export-boundary)\n"> <"\tEOF\n"> <"\tsed -e s/pack-.*pack/pack-.pack/ edges.list >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"J: reset existing branch creates empty commit">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/J\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcreate J\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch\n"> <"\n"> <"\treset refs/heads/J\n"> <"\n"> <"\tcommit refs/heads/J\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tinitialize J\n"> <"\tCOMMIT\n"> <"\n"> <"\tINPUT_END\n"> <"\tgit fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"J: branch has 1 commit, empty tree">)} { (SQ <"\n"> <"\ttest 1 = $(git rev-list J | wc -l) &&\n"> <"\ttest 0 = $(git ls-tree J | wc -l)\n"> ) } ) (C {(test_expect_success)} {(SQ <"J: tag must fail on empty branch">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\treset refs/heads/J2\n"> <"\n"> <"\ttag wrong_tag\n"> <"\tfrom refs/heads/J2\n"> <"\tdata <<EOF\n"> <"\tTag branch that was reset.\n"> <"\tEOF\n"> <"\tINPUT_END\n"> <"\ttest_must_fail git fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"K: reinit branch with from">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/K\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcreate K\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch\n"> <"\n"> <"\tcommit refs/heads/K\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tredo K\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^1\n"> <"\n"> <"\tINPUT_END\n"> <"\tgit fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"K: verify K^1 = branch^1">)} { (SQ <"\n"> <"\ttest $(git rev-parse --verify branch^1) \\\n"> <"\t\t= $(git rev-parse --verify K^1)\n"> ) } ) (C {(test_expect_success)} {(SQ <"L: verify internal tree sorting">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tblob\n"> <"\tmark :1\n"> <"\tdata <<EOF\n"> <"\tsome data\n"> <"\tEOF\n"> <"\n"> <"\tblob\n"> <"\tmark :2\n"> <"\tdata <<EOF\n"> <"\tother data\n"> <"\tEOF\n"> <"\n"> <"\tcommit refs/heads/L\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcreate L\n"> <"\tCOMMIT\n"> <"\n"> <"\tM 644 :1 b.\n"> <"\tM 644 :1 b/other\n"> <"\tM 644 :1 ba\n"> <"\n"> <"\tcommit refs/heads/L\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tupdate L\n"> <"\tCOMMIT\n"> <"\n"> <"\tM 644 :2 b.\n"> <"\tM 644 :2 b/other\n"> <"\tM 644 :2 ba\n"> <"\tINPUT_END\n"> <"\n"> <"\tcat >expect <<-EXPECT_END &&\n"> <"\t:100644 100644 4268632... 55d3a52... M\tb.\n"> <"\t:040000 040000 0ae5cac... 443c768... M\tb\n"> <"\t:100644 100644 4268632... 55d3a52... M\tba\n"> <"\tEXPECT_END\n"> <"\n"> <"\tgit fast-import <input &&\n"> <"\tgit diff-tree --abbrev --raw L^ L >output &&\n"> <"\ttest_cmp expect output\n"> ) } ) (C {(test_expect_success)} {(SQ <"L: nested tree copy does not corrupt deltas">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tblob\n"> <"\tmark :1\n"> <"\tdata <<EOF\n"> <"\tthe data\n"> <"\tEOF\n"> <"\n"> <"\tcommit refs/heads/L2\n"> <"\tcommitter C O Mitter <committer@example.com> 1112912473 -0700\n"> <"\tdata <<COMMIT\n"> <"\tinit L2\n"> <"\tCOMMIT\n"> <"\tM 644 :1 a/b/c\n"> <"\tM 644 :1 a/b/d\n"> <"\tM 644 :1 a/e/f\n"> <"\n"> <"\tcommit refs/heads/L2\n"> <"\tcommitter C O Mitter <committer@example.com> 1112912473 -0700\n"> <"\tdata <<COMMIT\n"> <"\tupdate L2\n"> <"\tCOMMIT\n"> <"\tC a g\n"> <"\tC a/e g/b\n"> <"\tM 644 :1 g/b/h\n"> <"\tINPUT_END\n"> <"\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\tg/b/f\n"> <"\tg/b/h\n"> <"\tEOF\n"> <"\n"> <"\ttest_when_finished \"git update-ref -d refs/heads/L2\" &&\n"> <"\tgit fast-import <input &&\n"> <"\tgit ls-tree L2 g/b/ >tmp &&\n"> <"\tcat tmp | cut -f 2 >actual &&\n"> <"\ttest_cmp expect actual &&\n"> <"\tgit fsck $(git rev-parse L2)\n"> ) } ) (C {(test_expect_success)} {(SQ <"M: rename file in same subdirectory">)} { (SQ <"\n"> <"\ttest_tick &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/M1\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tfile rename\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^0\n"> <"\tR file2/newf file2/n.e.w.f\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tcat >expect <<-EOF &&\n"> < "\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100\tfile2/newf\tfile2/n.e.w.f\n" > <"\tEOF\n"> <"\tgit fast-import <input &&\n"> <"\tgit diff-tree -M -r M1^ M1 >actual &&\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"M: rename file to new subdirectory">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/M2\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tfile rename\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^0\n"> <"\tR file2/newf i/am/new/to/you\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tcat >expect <<-EOF &&\n"> < "\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100\tfile2/newf\ti/am/new/to/you\n" > <"\tEOF\n"> <"\tgit fast-import <input &&\n"> <"\tgit diff-tree -M -r M2^ M2 >actual &&\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"M: rename subdirectory to new subdirectory">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/M3\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tfile rename\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/M2^0\n"> <"\tR i other/sub\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tcat >expect <<-EOF &&\n"> < "\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100\ti/am/new/to/you\tother/sub/am/new/to/you\n" > <"\tEOF\n"> <"\tgit fast-import <input &&\n"> <"\tgit diff-tree -M -r M3^ M3 >actual &&\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"M: rename root to subdirectory">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/M4\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\trename root\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/M2^0\n"> <"\tR \"\" sub\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tcat >expect <<-EOF &&\n"> < "\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 R100\tfile2/oldf\tsub/file2/oldf\n" > < "\t:100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 R100\tfile4\tsub/file4\n" > < "\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc R100\ti/am/new/to/you\tsub/i/am/new/to/you\n" > < "\t:100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 R100\tnewdir/exec.sh\tsub/newdir/exec.sh\n" > < "\t:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 R100\tnewdir/interesting\tsub/newdir/interesting\n" > <"\tEOF\n"> <"\tgit fast-import <input &&\n"> <"\tgit diff-tree -M -r M4^ M4 >actual &&\n"> <"\tcat actual &&\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"N: copy file in same subdirectory">)} { (SQ <"\n"> <"\ttest_tick &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/N1\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tfile copy\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^0\n"> <"\tC file2/newf file2/n.e.w.f\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tcat >expect <<-EOF &&\n"> < "\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile2/n.e.w.f\n" > <"\tEOF\n"> <"\tgit fast-import <input &&\n"> <"\tgit diff-tree -C --find-copies-harder -r N1^ N1 >actual &&\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"N: copy then modify subdirectory">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/N2\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tclean directory copy\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^0\n"> <"\tC file2 file3\n"> <"\n"> <"\tcommit refs/heads/N2\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tmodify directory copy\n"> <"\tCOMMIT\n"> <"\n"> <"\tM 644 inline file3/file5\n"> <"\tdata <<EOF\n"> <"\t$file5_data\n"> <"\tEOF\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tcat >expect <<-EOF &&\n"> < "\t:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100\tnewdir/interesting\tfile3/file5\n" > < "\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile3/newf\n" > < "\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\tfile3/oldf\n" > <"\tEOF\n"> <"\tgit fast-import <input &&\n"> <"\tgit diff-tree -C --find-copies-harder -r N2^^ N2 >actual &&\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"N: copy dirty subdirectory">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/N3\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tdirty directory copy\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^0\n"> <"\tM 644 inline file2/file5\n"> <"\tdata <<EOF\n"> <"\t$file5_data\n"> <"\tEOF\n"> <"\n"> <"\tC file2 file3\n"> <"\tD file2/file5\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tgit fast-import <input &&\n"> <"\ttest $(git rev-parse N2^{tree}) = $(git rev-parse N3^{tree})\n"> ) } ) (C {(test_expect_success)} {(SQ <"N: copy directory by id">)} { (SQ <"\n"> <"\tcat >expect <<-\\EOF &&\n"> < "\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile3/newf\n" > < "\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\tfile3/oldf\n" > <"\tEOF\n"> <"\tsubdir=$(git rev-parse refs/heads/branch^0:file2) &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/N4\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcopy by tree hash\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^0\n"> <"\tM 040000 $subdir file3\n"> <"\tINPUT_END\n"> <"\tgit fast-import <input &&\n"> <"\tgit diff-tree -C --find-copies-harder -r N4^ N4 >actual &&\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_expect_success)} {(PIPE)} {(SQ <"N: read and copy directory">)} { (SQ <"\n"> <"\tcat >expect <<-\\EOF &&\n"> < "\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile3/newf\n" > < "\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\tfile3/oldf\n" > <"\tEOF\n"> <"\tgit update-ref -d refs/heads/N4 &&\n"> <"\trm -f backflow &&\n"> <"\tmkfifo backflow &&\n"> <"\t(\n"> <"\t\texec <backflow &&\n"> <"\t\tcat <<-EOF &&\n"> <"\t\tcommit refs/heads/N4\n"> <"\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\t\tdata <<COMMIT\n"> <"\t\tcopy by tree hash, part 2\n"> <"\t\tCOMMIT\n"> <"\n"> <"\t\tfrom refs/heads/branch^0\n"> <"\t\tls \"file2\"\n"> <"\t\tEOF\n"> <"\t\tread mode type tree filename &&\n"> <"\t\techo \"M 040000 $tree file3\"\n"> <"\t) |\n"> <"\tgit fast-import --cat-blob-fd=3 3>backflow &&\n"> <"\tgit diff-tree -C --find-copies-harder -r N4^ N4 >actual &&\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_expect_success)} {(PIPE)} {(SQ <"N: empty directory reads as missing">)} { (SQ <"\n"> <"\tcat <<-\\EOF >expect &&\n"> <"\tOBJNAME\n"> <"\t:000000 100644 OBJNAME OBJNAME A\tunrelated\n"> <"\tEOF\n"> <"\techo \"missing src\" >expect.response &&\n"> <"\tgit update-ref -d refs/heads/read-empty &&\n"> <"\trm -f backflow &&\n"> <"\tmkfifo backflow &&\n"> <"\t(\n"> <"\t\texec <backflow &&\n"> <"\t\tcat <<-EOF &&\n"> <"\t\tcommit refs/heads/read-empty\n"> <"\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\t\tdata <<COMMIT\n"> <"\t\tread \"empty\" (missing) directory\n"> <"\t\tCOMMIT\n"> <"\n"> <"\t\tM 100644 inline src/greeting\n"> <"\t\tdata <<BLOB\n"> <"\t\thello\n"> <"\t\tBLOB\n"> <"\t\tC src/greeting dst1/non-greeting\n"> <"\t\tC src/greeting unrelated\n"> <"\t\t# leave behind \"empty\" src directory\n"> <"\t\tD src/greeting\n"> <"\t\tls \"src\"\n"> <"\t\tEOF\n"> <"\t\tread -r line &&\n"> <"\t\tprintf \"%s\\n\" \"$line\" >response &&\n"> <"\t\tcat <<-\\EOF\n"> <"\t\tD dst1\n"> <"\t\tD dst2\n"> <"\t\tEOF\n"> <"\t) |\n"> <"\tgit fast-import --cat-blob-fd=3 3>backflow &&\n"> <"\ttest_cmp expect.response response &&\n"> <"\tgit rev-list read-empty |\n"> <"\tgit diff-tree -r --root --stdin |\n"> <"\tsed \"s/$_x40/OBJNAME/g\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"N: copy root directory by tree hash">)} { (SQ <"\n"> <"\tcat >expect <<-\\EOF &&\n"> < "\t:100755 000000 f1fb5da718392694d0076d677d6d0e364c79b0bc 0000000000000000000000000000000000000000 D\tfile3/newf\n" > < "\t:100644 000000 7123f7f44e39be127c5eb701e5968176ee9d78b1 0000000000000000000000000000000000000000 D\tfile3/oldf\n" > <"\tEOF\n"> <"\troot=$(git rev-parse refs/heads/branch^0^{tree}) &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/N6\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcopy root directory by tree hash\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^0\n"> <"\tM 040000 $root \"\"\n"> <"\tINPUT_END\n"> <"\tgit fast-import <input &&\n"> <"\tgit diff-tree -C --find-copies-harder -r N4 N6 >actual &&\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"N: copy root by path">)} { (SQ <"\n"> <"\tcat >expect <<-\\EOF &&\n"> < "\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\toldroot/file2/newf\n" > < "\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\toldroot/file2/oldf\n" > < "\t:100755 100755 85df50785d62d3b05ab03d9cbf7e4a0b49449730 85df50785d62d3b05ab03d9cbf7e4a0b49449730 C100\tfile4\toldroot/file4\n" > < "\t:100755 100755 e74b7d465e52746be2b4bae983670711e6e66657 e74b7d465e52746be2b4bae983670711e6e66657 C100\tnewdir/exec.sh\toldroot/newdir/exec.sh\n" > < "\t:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100\tnewdir/interesting\toldroot/newdir/interesting\n" > <"\tEOF\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/N-copy-root-path\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcopy root directory by (empty) path\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^0\n"> <"\tC \"\" oldroot\n"> <"\tINPUT_END\n"> <"\tgit fast-import <input &&\n"> <"\tgit diff-tree -C --find-copies-harder -r branch N-copy-root-path >actual &&\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"N: delete directory by copying">)} { (SQ <"\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\tOBJID\n"> <"\t:100644 000000 OBJID OBJID D\tfoo/bar/qux\n"> <"\tOBJID\n"> <"\t:000000 100644 OBJID OBJID A\tfoo/bar/baz\n"> <"\t:000000 100644 OBJID OBJID A\tfoo/bar/qux\n"> <"\tEOF\n"> <"\tempty_tree=$(git mktree </dev/null) &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/N-delete\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcollect data to be deleted\n"> <"\tCOMMIT\n"> <"\n"> <"\tdeleteall\n"> <"\tM 100644 inline foo/bar/baz\n"> <"\tdata <<DATA_END\n"> <"\thello\n"> <"\tDATA_END\n"> <"\tC \"foo/bar/baz\" \"foo/bar/qux\"\n"> <"\tC \"foo/bar/baz\" \"foo/bar/quux/1\"\n"> <"\tC \"foo/bar/baz\" \"foo/bar/quuux\"\n"> <"\tM 040000 $empty_tree foo/bar/quux\n"> <"\tM 040000 $empty_tree foo/bar/quuux\n"> <"\n"> <"\tcommit refs/heads/N-delete\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tdelete subdirectory\n"> <"\tCOMMIT\n"> <"\n"> <"\tM 040000 $empty_tree foo/bar/qux\n"> <"\tINPUT_END\n"> <"\tgit fast-import <input &&\n"> <"\tgit rev-list N-delete |\n"> <"\t\tgit diff-tree -r --stdin --root --always |\n"> <"\t\tsed -e \"s/$_x40/OBJID/g\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"N: modify copied tree">)} { (SQ <"\n"> <"\tcat >expect <<-\\EOF &&\n"> < "\t:100644 100644 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 fcf778cda181eaa1cbc9e9ce3a2e15ee9f9fe791 C100\tnewdir/interesting\tfile3/file5\n" > < "\t:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100\tfile2/newf\tfile3/newf\n" > < "\t:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100\tfile2/oldf\tfile3/oldf\n" > <"\tEOF\n"> <"\tsubdir=$(git rev-parse refs/heads/branch^0:file2) &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/N5\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcopy by tree hash\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^0\n"> <"\tM 040000 $subdir file3\n"> <"\n"> <"\tcommit refs/heads/N5\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tmodify directory copy\n"> <"\tCOMMIT\n"> <"\n"> <"\tM 644 inline file3/file5\n"> <"\tdata <<EOF\n"> <"\t$file5_data\n"> <"\tEOF\n"> <"\tINPUT_END\n"> <"\tgit fast-import <input &&\n"> <"\tgit diff-tree -C --find-copies-harder -r N5^^ N5 >actual &&\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"N: reject foo/ syntax">)} { (SQ <"\n"> <"\tsubdir=$(git rev-parse refs/heads/branch^0:file2) &&\n"> <"\ttest_must_fail git fast-import <<-INPUT_END\n"> <"\tcommit refs/heads/N5B\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcopy with invalid syntax\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^0\n"> <"\tM 040000 $subdir file3/\n"> <"\tINPUT_END\n"> ) } ) (C {(test_expect_success)} {(SQ <"N: reject foo/ syntax in copy source">)} { (SQ <"\n"> <"\ttest_must_fail git fast-import <<-INPUT_END\n"> <"\tcommit refs/heads/N5C\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcopy with invalid syntax\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^0\n"> <"\tC file2/ file3\n"> <"\tINPUT_END\n"> ) } ) (C {(test_expect_success)} {(SQ <"N: reject foo/ syntax in rename source">)} { (SQ <"\n"> <"\ttest_must_fail git fast-import <<-INPUT_END\n"> <"\tcommit refs/heads/N5D\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\trename with invalid syntax\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^0\n"> <"\tR file2/ file3\n"> <"\tINPUT_END\n"> ) } ) (C {(test_expect_success)} {(SQ <"N: reject foo/ syntax in ls argument">)} { (SQ <"\n"> <"\ttest_must_fail git fast-import <<-INPUT_END\n"> <"\tcommit refs/heads/N5E\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcopy with invalid syntax\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/branch^0\n"> <"\tls \"file2/\"\n"> <"\tINPUT_END\n"> ) } ) (C {(test_expect_success)} {(SQ <"N: copy to root by id and modify">)} { (SQ <"\n"> <"\techo \"hello, world\" >expect.foo &&\n"> <"\techo hello >expect.bar &&\n"> <"\tgit fast-import <<-SETUP_END &&\n"> <"\tcommit refs/heads/N7\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\thello, tree\n"> <"\tCOMMIT\n"> <"\n"> <"\tdeleteall\n"> <"\tM 644 inline foo/bar\n"> <"\tdata <<EOF\n"> <"\thello\n"> <"\tEOF\n"> <"\tSETUP_END\n"> <"\n"> <"\ttree=$(git rev-parse --verify N7:) &&\n"> <"\tgit fast-import <<-INPUT_END &&\n"> <"\tcommit refs/heads/N8\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcopy to root by id and modify\n"> <"\tCOMMIT\n"> <"\n"> <"\tM 040000 $tree \"\"\n"> <"\tM 644 inline foo/foo\n"> <"\tdata <<EOF\n"> <"\thello, world\n"> <"\tEOF\n"> <"\tINPUT_END\n"> <"\tgit show N8:foo/foo >actual.foo &&\n"> <"\tgit show N8:foo/bar >actual.bar &&\n"> <"\ttest_cmp expect.foo actual.foo &&\n"> <"\ttest_cmp expect.bar actual.bar\n"> ) } ) (C {(test_expect_success)} {(SQ <"N: extract subtree">)} { (SQ <"\n"> <"\tbranch=$(git rev-parse --verify refs/heads/branch^{tree}) &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/N9\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\textract subtree branch:newdir\n"> <"\tCOMMIT\n"> <"\n"> <"\tM 040000 $branch \"\"\n"> <"\tC \"newdir\" \"\"\n"> <"\tINPUT_END\n"> <"\tgit fast-import <input &&\n"> <"\tgit diff --exit-code branch:newdir N9\n"> ) } ) (C {(test_expect_success)} {(SQ <"N: modify subtree, extract it, and modify again">)} { (SQ <"\n"> <"\techo hello >expect.baz &&\n"> <"\techo hello, world >expect.qux &&\n"> <"\tgit fast-import <<-SETUP_END &&\n"> <"\tcommit refs/heads/N10\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\thello, tree\n"> <"\tCOMMIT\n"> <"\n"> <"\tdeleteall\n"> <"\tM 644 inline foo/bar/baz\n"> <"\tdata <<EOF\n"> <"\thello\n"> <"\tEOF\n"> <"\tSETUP_END\n"> <"\n"> <"\ttree=$(git rev-parse --verify N10:) &&\n"> <"\tgit fast-import <<-INPUT_END &&\n"> <"\tcommit refs/heads/N11\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcopy to root by id and modify\n"> <"\tCOMMIT\n"> <"\n"> <"\tM 040000 $tree \"\"\n"> <"\tM 100644 inline foo/bar/qux\n"> <"\tdata <<EOF\n"> <"\thello, world\n"> <"\tEOF\n"> <"\tR \"foo\" \"\"\n"> <"\tC \"bar/qux\" \"bar/quux\"\n"> <"\tINPUT_END\n"> <"\tgit show N11:bar/baz >actual.baz &&\n"> <"\tgit show N11:bar/qux >actual.qux &&\n"> <"\tgit show N11:bar/quux >actual.quux &&\n"> <"\ttest_cmp expect.baz actual.baz &&\n"> <"\ttest_cmp expect.qux actual.qux &&\n"> <"\ttest_cmp expect.qux actual.quux"> ) } ) (C {(test_expect_success)} {(SQ <"O: comments are all skipped">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\t#we will\n"> <"\tcommit refs/heads/O1\n"> <"\t# -- ignore all of this text\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\t# $GIT_COMMITTER_NAME has inserted here for his benefit.\n"> <"\tdata <<COMMIT\n"> <"\tdirty directory copy\n"> <"\tCOMMIT\n"> <"\n"> <"\t# do not forget the import blank line!\n"> <"\t#\n"> <"\t# yes, we started from our usual base of branch^0.\n"> <"\t# i like branch^0.\n"> <"\tfrom refs/heads/branch^0\n"> <"\t# and we need to reuse file2/file5 from N3 above.\n"> <"\tM 644 inline file2/file5\n"> <"\t# otherwise the tree will be different\n"> <"\tdata <<EOF\n"> <"\t$file5_data\n"> <"\tEOF\n"> <"\n"> <"\t# do not forget to copy file2 to file3\n"> <"\tC file2 file3\n"> <"\t#\n"> <"\t# or to delete file5 from file2.\n"> <"\tD file2/file5\n"> <"\t# are we done yet?\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tgit fast-import <input &&\n"> <"\ttest $(git rev-parse N3) = $(git rev-parse O1)\n"> ) } ) (C {(test_expect_success)} {(SQ <"O: blank lines not necessary after data commands">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/O2\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tdirty directory copy\n"> <"\tCOMMIT\n"> <"\tfrom refs/heads/branch^0\n"> <"\tM 644 inline file2/file5\n"> <"\tdata <<EOF\n"> <"\t$file5_data\n"> <"\tEOF\n"> <"\tC file2 file3\n"> <"\tD file2/file5\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tgit fast-import <input &&\n"> <"\ttest $(git rev-parse N3) = $(git rev-parse O2)\n"> ) } ) (C {(test_expect_success)} {(SQ <"O: repack before next test">)} {(SQ <"\n"> <"\tgit repack -a -d\n">)} ) (C {(test_expect_success)} {(SQ <"O: blank lines not necessary after other commands">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/O3\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tzstring\n"> <"\tCOMMIT\n"> <"\tcommit refs/heads/O3\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tzof\n"> <"\tCOMMIT\n"> <"\tcheckpoint\n"> <"\tcommit refs/heads/O3\n"> <"\tmark :5\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tzempty\n"> <"\tCOMMIT\n"> <"\tcheckpoint\n"> <"\tcommit refs/heads/O3\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tzcommits\n"> <"\tCOMMIT\n"> <"\treset refs/tags/O3-2nd\n"> <"\tfrom :5\n"> <"\treset refs/tags/O3-3rd\n"> <"\tfrom :5\n"> <"\tINPUT_END\n"> <"\n"> <"\tcat >expect <<-INPUT_END &&\n"> <"\tstring\n"> <"\tof\n"> <"\tempty\n"> <"\tcommits\n"> <"\tINPUT_END\n"> <"\n"> <"\tgit fast-import <input &&\n"> <"\ttest 8 = $(find .git/objects/pack -type f | wc -l) &&\n"> <"\ttest $(git rev-parse refs/tags/O3-2nd) = $(git rev-parse O3^) &&\n"> <"\tgit log --reverse --pretty=oneline O3 | sed s/^.*z// >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"O: progress outputs as requested by input">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/O4\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tzstring\n"> <"\tCOMMIT\n"> <"\tcommit refs/heads/O4\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tzof\n"> <"\tCOMMIT\n"> <"\tprogress Two commits down, 2 to go!\n"> <"\tcommit refs/heads/O4\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tzempty\n"> <"\tCOMMIT\n"> <"\tprogress Three commits down, 1 to go!\n"> <"\tcommit refs/heads/O4\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tzcommits\n"> <"\tCOMMIT\n"> <"\tprogress done!\n"> <"\tINPUT_END\n"> <"\tgit fast-import <input >actual &&\n"> <"\tgrep \"progress \" <input >expect &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"P: superproject & submodule mix">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tblob\n"> <"\tmark :1\n"> <"\tdata 10\n"> <"\ttest file\n"> <"\n"> <"\treset refs/heads/sub\n"> <"\tcommit refs/heads/sub\n"> <"\tmark :2\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata 12\n"> <"\tsub_initial\n"> <"\tM 100644 :1 file\n"> <"\n"> <"\tblob\n"> <"\tmark :3\n"> <"\tdata <<DATAEND\n"> <"\t[submodule \"sub\"]\n"> <"\t\tpath = sub\n"> <"\t\turl = \"$(pwd)/sub\"\n"> <"\tDATAEND\n"> <"\n"> <"\tcommit refs/heads/subuse1\n"> <"\tmark :4\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata 8\n"> <"\tinitial\n"> <"\tfrom refs/heads/master\n"> <"\tM 100644 :3 .gitmodules\n"> <"\tM 160000 :2 sub\n"> <"\n"> <"\tblob\n"> <"\tmark :5\n"> <"\tdata 20\n"> <"\ttest file\n"> <"\tmore data\n"> <"\n"> <"\tcommit refs/heads/sub\n"> <"\tmark :6\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata 11\n"> <"\tsub_second\n"> <"\tfrom :2\n"> <"\tM 100644 :5 file\n"> <"\n"> <"\tcommit refs/heads/subuse1\n"> <"\tmark :7\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata 7\n"> <"\tsecond\n"> <"\tfrom :4\n"> <"\tM 160000 :6 sub\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tgit fast-import <input &&\n"> <"\tgit checkout subuse1 &&\n"> <"\trm -rf sub &&\n"> <"\tmkdir sub &&\n"> <"\t(\n"> <"\t\tcd sub &&\n"> <"\t\tgit init &&\n"> <"\t\tgit fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&\n"> <"\t\tgit checkout master\n"> <"\t) &&\n"> <"\tgit submodule init &&\n"> <"\tgit submodule update\n"> ) } ) (C {(test_expect_success)} {(SQ <"P: verbatim SHA gitlinks">)} { (SQ <"\n"> <"\tSUBLAST=$(git rev-parse --verify sub) &&\n"> <"\tSUBPREV=$(git rev-parse --verify sub^) &&\n"> <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tblob\n"> <"\tmark :1\n"> <"\tdata <<DATAEND\n"> <"\t[submodule \"sub\"]\n"> <"\t\tpath = sub\n"> <"\t\turl = \"$(pwd)/sub\"\n"> <"\tDATAEND\n"> <"\n"> <"\tcommit refs/heads/subuse2\n"> <"\tmark :2\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata 8\n"> <"\tinitial\n"> <"\tfrom refs/heads/master\n"> <"\tM 100644 :1 .gitmodules\n"> <"\tM 160000 $SUBPREV sub\n"> <"\n"> <"\tcommit refs/heads/subuse2\n"> <"\tmark :3\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata 7\n"> <"\tsecond\n"> <"\tfrom :2\n"> <"\tM 160000 $SUBLAST sub\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tgit branch -D sub &&\n"> <"\tgit gc &&\n"> <"\tgit prune &&\n"> <"\tgit fast-import <input &&\n"> <"\ttest $(git rev-parse --verify subuse2) = $(git rev-parse --verify subuse1)\n"> ) } ) (C {(test_expect_success)} {(SQ <"P: fail on inline gitlink">)} { (SQ <"\n"> <"\ttest_tick &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/subuse3\n"> <"\tmark :1\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcorrupt\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/subuse2\n"> <"\tM 160000 inline sub\n"> <"\tdata <<DATA\n"> <"\t$SUBPREV\n"> <"\tDATA\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\ttest_must_fail git fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"P: fail on blob mark in gitlink">)} { (SQ <"\n"> <"\ttest_tick &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tblob\n"> <"\tmark :1\n"> <"\tdata <<DATA\n"> <"\t$SUBPREV\n"> <"\tDATA\n"> <"\n"> <"\tcommit refs/heads/subuse3\n"> <"\tmark :2\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcorrupt\n"> <"\tCOMMIT\n"> <"\n"> <"\tfrom refs/heads/subuse2\n"> <"\tM 160000 :1 sub\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\ttest_must_fail git fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: commit notes">)} { (SQ <"\n"> <"\tnote1_data=\"The first note for the first commit\" &&\n"> <"\tnote2_data=\"The first note for the second commit\" &&\n"> <"\tnote3_data=\"The first note for the third commit\" &&\n"> <"\tnote1b_data=\"The second note for the first commit\" &&\n"> <"\tnote1c_data=\"The third note for the first commit\" &&\n"> <"\tnote2b_data=\"The second note for the second commit\" &&\n"> <"\n"> <"\ttest_tick &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tblob\n"> <"\tmark :2\n"> <"\tdata <<EOF\n"> <"\t$file2_data\n"> <"\tEOF\n"> <"\n"> <"\tcommit refs/heads/notes-test\n"> <"\tmark :3\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tfirst (:3)\n"> <"\tCOMMIT\n"> <"\n"> <"\tM 644 :2 file2\n"> <"\n"> <"\tblob\n"> <"\tmark :4\n"> <"\tdata $file4_len\n"> <"\t$file4_data\n"> <"\tcommit refs/heads/notes-test\n"> <"\tmark :5\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tsecond (:5)\n"> <"\tCOMMIT\n"> <"\n"> <"\tM 644 :4 file4\n"> <"\n"> <"\tcommit refs/heads/notes-test\n"> <"\tmark :6\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tthird (:6)\n"> <"\tCOMMIT\n"> <"\n"> <"\tM 644 inline file5\n"> <"\tdata <<EOF\n"> <"\t$file5_data\n"> <"\tEOF\n"> <"\n"> <"\tM 755 inline file6\n"> <"\tdata <<EOF\n"> <"\t$file6_data\n"> <"\tEOF\n"> <"\n"> <"\tblob\n"> <"\tmark :7\n"> <"\tdata <<EOF\n"> <"\t$note1_data\n"> <"\tEOF\n"> <"\n"> <"\tblob\n"> <"\tmark :8\n"> <"\tdata <<EOF\n"> <"\t$note2_data\n"> <"\tEOF\n"> <"\n"> <"\tcommit refs/notes/foobar\n"> <"\tmark :9\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tnotes (:9)\n"> <"\tCOMMIT\n"> <"\n"> <"\tN :7 :3\n"> <"\tN :8 :5\n"> <"\tN inline :6\n"> <"\tdata <<EOF\n"> <"\t$note3_data\n"> <"\tEOF\n"> <"\n"> <"\tcommit refs/notes/foobar\n"> <"\tmark :10\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tnotes (:10)\n"> <"\tCOMMIT\n"> <"\n"> <"\tN inline :3\n"> <"\tdata <<EOF\n"> <"\t$note1b_data\n"> <"\tEOF\n"> <"\n"> <"\tcommit refs/notes/foobar2\n"> <"\tmark :11\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tnotes (:11)\n"> <"\tCOMMIT\n"> <"\n"> <"\tN inline :3\n"> <"\tdata <<EOF\n"> <"\t$note1c_data\n"> <"\tEOF\n"> <"\n"> <"\tcommit refs/notes/foobar\n"> <"\tmark :12\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tnotes (:12)\n"> <"\tCOMMIT\n"> <"\n"> <"\tdeleteall\n"> <"\tN inline :5\n"> <"\tdata <<EOF\n"> <"\t$note2b_data\n"> <"\tEOF\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tgit fast-import <input &&\n"> <"\tgit whatchanged notes-test\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify pack">)} {(SQ <"\n"> <"\tverify_packs\n">)}) (C {(test_expect_success)} {(SQ <"Q: verify first commit">)} { (SQ <"\n"> <"\tcommit1=$(git rev-parse notes-test~2) &&\n"> <"\tcommit2=$(git rev-parse notes-test^) &&\n"> <"\tcommit3=$(git rev-parse notes-test) &&\n"> <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\n"> <"\tfirst (:3)\n"> <"\tEOF\n"> <"\tgit cat-file commit notes-test~2 | sed 1d >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify second commit">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\tparent $commit1\n"> <"\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\n"> <"\tsecond (:5)\n"> <"\tEOF\n"> <"\tgit cat-file commit notes-test^ | sed 1d >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify third commit">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\tparent $commit2\n"> <"\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\n"> <"\tthird (:6)\n"> <"\tEOF\n"> <"\tgit cat-file commit notes-test | sed 1d >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify first notes commit">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\n"> <"\tnotes (:9)\n"> <"\tEOF\n"> <"\tgit cat-file commit refs/notes/foobar~2 | sed 1d >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify first notes tree">)} { (SQ <"\n"> <"\tcat >expect.unsorted <<-EOF &&\n"> <"\t100644 blob $commit1\n"> <"\t100644 blob $commit2\n"> <"\t100644 blob $commit3\n"> <"\tEOF\n"> <"\tcat expect.unsorted | sort >expect &&\n"> <"\tgit cat-file -p refs/notes/foobar~2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify first note for first commit">)} { (SQ <"\n"> <"\techo \"$note1_data\" >expect &&\n"> <"\tgit cat-file blob refs/notes/foobar~2:$commit1 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify first note for second commit">)} { (SQ <"\n"> <"\techo \"$note2_data\" >expect &&\n"> <"\tgit cat-file blob refs/notes/foobar~2:$commit2 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify first note for third commit">)} { (SQ <"\n"> <"\techo \"$note3_data\" >expect &&\n"> <"\tgit cat-file blob refs/notes/foobar~2:$commit3 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify second notes commit">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\tparent $(git rev-parse --verify refs/notes/foobar~2)\n"> <"\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\n"> <"\tnotes (:10)\n"> <"\tEOF\n"> <"\tgit cat-file commit refs/notes/foobar^ | sed 1d >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify second notes tree">)} { (SQ <"\n"> <"\tcat >expect.unsorted <<-EOF &&\n"> <"\t100644 blob $commit1\n"> <"\t100644 blob $commit2\n"> <"\t100644 blob $commit3\n"> <"\tEOF\n"> <"\tcat expect.unsorted | sort >expect &&\n"> <"\tgit cat-file -p refs/notes/foobar^^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify second note for first commit">)} { (SQ <"\n"> <"\techo \"$note1b_data\" >expect &&\n"> <"\tgit cat-file blob refs/notes/foobar^:$commit1 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify first note for second commit">)} { (SQ <"\n"> <"\techo \"$note2_data\" >expect &&\n"> <"\tgit cat-file blob refs/notes/foobar^:$commit2 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify first note for third commit">)} { (SQ <"\n"> <"\techo \"$note3_data\" >expect &&\n"> <"\tgit cat-file blob refs/notes/foobar^:$commit3 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify third notes commit">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\n"> <"\tnotes (:11)\n"> <"\tEOF\n"> <"\tgit cat-file commit refs/notes/foobar2 | sed 1d >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify third notes tree">)} { (SQ <"\n"> <"\tcat >expect.unsorted <<-EOF &&\n"> <"\t100644 blob $commit1\n"> <"\tEOF\n"> <"\tcat expect.unsorted | sort >expect &&\n"> <"\tgit cat-file -p refs/notes/foobar2^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify third note for first commit">)} { (SQ <"\n"> <"\techo \"$note1c_data\" >expect &&\n"> <"\tgit cat-file blob refs/notes/foobar2:$commit1 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify fourth notes commit">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> <"\tparent $(git rev-parse --verify refs/notes/foobar^)\n"> <"\tauthor $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\n"> <"\tnotes (:12)\n"> <"\tEOF\n"> <"\tgit cat-file commit refs/notes/foobar | sed 1d >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify fourth notes tree">)} { (SQ <"\n"> <"\tcat >expect.unsorted <<-EOF &&\n"> <"\t100644 blob $commit2\n"> <"\tEOF\n"> <"\tcat expect.unsorted | sort >expect &&\n"> <"\tgit cat-file -p refs/notes/foobar^{tree} | sed \"s/ [0-9a-f]*\t/ /\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: verify second note for second commit">)} { (SQ <"\n"> <"\techo \"$note2b_data\" >expect &&\n"> <"\tgit cat-file blob refs/notes/foobar:$commit2 >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"Q: deny note on empty branch">)} { (SQ <"\n"> <"\tcat >input <<-EOF &&\n"> <"\treset refs/heads/Q0\n"> <"\n"> <"\tcommit refs/heads/note-Q0\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tNote for an empty branch.\n"> <"\tCOMMIT\n"> <"\n"> <"\tN inline refs/heads/Q0\n"> <"\tdata <<NOTE\n"> <"\tsome note\n"> <"\tNOTE\n"> <"\tEOF\n"> <"\ttest_must_fail git fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: abort on unsupported feature">)} { (SQ <"\n"> <"\tcat >input <<-EOF &&\n"> <"\tfeature no-such-feature-exists\n"> <"\tEOF\n"> <"\n"> <"\ttest_must_fail git fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: supported feature is accepted">)} { (SQ <"\n"> <"\tcat >input <<-EOF &&\n"> <"\tfeature date-format=now\n"> <"\tEOF\n"> <"\n"> <"\tgit fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: abort on receiving feature after data command">)} { (SQ <"\n"> <"\tcat >input <<-EOF &&\n"> <"\tblob\n"> <"\tdata 3\n"> <"\thi\n"> <"\tfeature date-format=now\n"> <"\tEOF\n"> <"\n"> <"\ttest_must_fail git fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: only one import-marks feature allowed per stream">)} { (SQ <"\n"> <"\tcat >input <<-EOF &&\n"> <"\tfeature import-marks=git.marks\n"> <"\tfeature import-marks=git2.marks\n"> <"\tEOF\n"> <"\n"> <"\ttest_must_fail git fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: export-marks feature results in a marks file being created">)} { (SQ <"\n"> <"\tcat >input <<-EOF &&\n"> <"\tfeature export-marks=git.marks\n"> <"\tblob\n"> <"\tmark :1\n"> <"\tdata 3\n"> <"\thi\n"> <"\n"> <"\tEOF\n"> <"\n"> <"\tcat input | git fast-import &&\n"> <"\tgrep :1 git.marks\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: export-marks options can be overridden by commandline options">)} { (SQ <"\n"> <"\tcat input | git fast-import --export-marks=other.marks &&\n"> <"\tgrep :1 other.marks\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: catch typo in marks file name">)} { (SQ <"\n"> <"\ttest_must_fail git fast-import --import-marks=nonexistent.marks </dev/null &&\n"> <"\techo \"feature import-marks=nonexistent.marks\" |\n"> <"\ttest_must_fail git fast-import\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: import and output marks can be the same file">)} { (SQ <"\n"> <"\trm -f io.marks &&\n"> <"\tblob=$(echo hi | git hash-object --stdin) &&\n"> <"\tcat >expect <<-EOF &&\n"> <"\t:1 $blob\n"> <"\t:2 $blob\n"> <"\tEOF\n"> <"\tgit fast-import --export-marks=io.marks <<-\\EOF &&\n"> <"\tblob\n"> <"\tmark :1\n"> <"\tdata 3\n"> <"\thi\n"> <"\n"> <"\tEOF\n"> <"\tgit fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n"> <"\tblob\n"> <"\tmark :2\n"> <"\tdata 3\n"> <"\thi\n"> <"\n"> <"\tEOF\n"> <"\ttest_cmp expect io.marks\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: --import-marks=foo --output-marks=foo to create foo fails">)} { (SQ <"\n"> <"\trm -f io.marks &&\n"> < "\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF\n" > <"\tblob\n"> <"\tmark :1\n"> <"\tdata 3\n"> <"\thi\n"> <"\n"> <"\tEOF\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: --import-marks-if-exists">)} { (SQ <"\n"> <"\trm -f io.marks &&\n"> <"\tblob=$(echo hi | git hash-object --stdin) &&\n"> <"\techo \":1 $blob\" >expect &&\n"> <"\tgit fast-import --import-marks-if-exists=io.marks --export-marks=io.marks <<-\\EOF &&\n"> <"\tblob\n"> <"\tmark :1\n"> <"\tdata 3\n"> <"\thi\n"> <"\n"> <"\tEOF\n"> <"\ttest_cmp expect io.marks\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: feature import-marks-if-exists">)} { (SQ <"\n"> <"\trm -f io.marks &&\n"> <"\t>expect &&\n"> <"\n"> <"\tgit fast-import --export-marks=io.marks <<-\\EOF &&\n"> <"\tfeature import-marks-if-exists=not_io.marks\n"> <"\tEOF\n"> <"\ttest_cmp expect io.marks &&\n"> <"\n"> <"\tblob=$(echo hi | git hash-object --stdin) &&\n"> <"\n"> <"\techo \":1 $blob\" >io.marks &&\n"> <"\techo \":1 $blob\" >expect &&\n"> <"\techo \":2 $blob\" >>expect &&\n"> <"\n"> <"\tgit fast-import --export-marks=io.marks <<-\\EOF &&\n"> <"\tfeature import-marks-if-exists=io.marks\n"> <"\tblob\n"> <"\tmark :2\n"> <"\tdata 3\n"> <"\thi\n"> <"\n"> <"\tEOF\n"> <"\ttest_cmp expect io.marks &&\n"> <"\n"> <"\techo \":3 $blob\" >>expect &&\n"> <"\n"> <"\tgit fast-import --import-marks=io.marks \\\n"> <"\t\t\t--export-marks=io.marks <<-\\EOF &&\n"> <"\tfeature import-marks-if-exists=not_io.marks\n"> <"\tblob\n"> <"\tmark :3\n"> <"\tdata 3\n"> <"\thi\n"> <"\n"> <"\tEOF\n"> <"\ttest_cmp expect io.marks &&\n"> <"\n"> <"\t>expect &&\n"> <"\n"> <"\tgit fast-import --import-marks-if-exists=not_io.marks \\\n"> <"\t\t\t--export-marks=io.marks <<-\\EOF &&\n"> <"\tfeature import-marks-if-exists=io.marks\n"> <"\tEOF\n"> <"\ttest_cmp expect io.marks\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: import to output marks works without any content">)} { (SQ <"\n"> <"\tcat >input <<-EOF &&\n"> <"\tfeature import-marks=marks.out\n"> <"\tfeature export-marks=marks.new\n"> <"\tEOF\n"> <"\n"> <"\tcat input | git fast-import &&\n"> <"\ttest_cmp marks.out marks.new\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: import marks prefers commandline marks file over the stream">)} { (SQ <"\n"> <"\tcat >input <<-EOF &&\n"> <"\tfeature import-marks=nonexistent.marks\n"> <"\tfeature export-marks=marks.new\n"> <"\tEOF\n"> <"\n"> <"\tcat input | git fast-import --import-marks=marks.out &&\n"> <"\ttest_cmp marks.out marks.new\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: multiple --import-marks= should be honoured">)} { (SQ <"\n"> <"\tcat >input <<-EOF &&\n"> <"\tfeature import-marks=nonexistent.marks\n"> <"\tfeature export-marks=combined.marks\n"> <"\tEOF\n"> <"\n"> <"\thead -n2 marks.out > one.marks &&\n"> <"\ttail -n +3 marks.out > two.marks &&\n"> <"\tgit fast-import --import-marks=one.marks --import-marks=two.marks <input &&\n"> <"\ttest_cmp marks.out combined.marks\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: feature relative-marks should be honoured">)} { (SQ <"\n"> <"\tcat >input <<-EOF &&\n"> <"\tfeature relative-marks\n"> <"\tfeature import-marks=relative.in\n"> <"\tfeature export-marks=relative.out\n"> <"\tEOF\n"> <"\n"> <"\tmkdir -p .git/info/fast-import/ &&\n"> <"\tcp marks.new .git/info/fast-import/relative.in &&\n"> <"\tgit fast-import <input &&\n"> <"\ttest_cmp marks.new .git/info/fast-import/relative.out\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: feature no-relative-marks should be honoured">)} { (SQ <"\n"> <"\tcat >input <<-EOF &&\n"> <"\tfeature relative-marks\n"> <"\tfeature import-marks=relative.in\n"> <"\tfeature no-relative-marks\n"> <"\tfeature export-marks=non-relative.out\n"> <"\tEOF\n"> <"\n"> <"\tgit fast-import <input &&\n"> <"\ttest_cmp marks.new non-relative.out\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: feature ls supported">)} {(SQ <"\n"> <"\techo \"feature ls\" |\n"> <"\tgit fast-import\n">)} ) (C {(test_expect_success)} {(SQ <"R: feature cat-blob supported">)} {(SQ <"\n"> <"\techo \"feature cat-blob\" |\n"> <"\tgit fast-import\n">)} ) (C {(test_expect_success)} {(SQ <"R: cat-blob-fd must be a nonnegative integer">)} {(SQ <"\n"> <"\ttest_must_fail git fast-import --cat-blob-fd=-1 </dev/null\n">)} ) (C {(test_expect_success)} {(KW_Bang "!") (MINGW)} {(SQ <"R: print old blob">)} { (SQ <"\n"> <"\tblob=$(echo \"yes it can\" | git hash-object -w --stdin) &&\n"> <"\tcat >expect <<-EOF &&\n"> <"\t${blob} blob 11\n"> <"\tyes it can\n"> <"\n"> <"\tEOF\n"> <"\techo \"cat-blob $blob\" |\n"> <"\tgit fast-import --cat-blob-fd=6 6>actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(KW_Bang "!") (MINGW)} {(SQ <"R: in-stream cat-blob-fd not respected">)} { (SQ <"\n"> <"\techo hello >greeting &&\n"> <"\tblob=$(git hash-object -w greeting) &&\n"> <"\tcat >expect <<-EOF &&\n"> <"\t${blob} blob 6\n"> <"\thello\n"> <"\n"> <"\tEOF\n"> <"\tgit fast-import --cat-blob-fd=3 3>actual.3 >actual.1 <<-EOF &&\n"> <"\tcat-blob $blob\n"> <"\tEOF\n"> <"\ttest_cmp expect actual.3 &&\n"> <"\ttest_must_be_empty actual.1 &&\n"> <"\tgit fast-import 3>actual.3 >actual.1 <<-EOF &&\n"> <"\toption cat-blob-fd=3\n"> <"\tcat-blob $blob\n"> <"\tEOF\n"> <"\ttest_must_be_empty actual.3 &&\n"> <"\ttest_cmp expect actual.1\n"> ) } ) (C {(test_expect_success)} {(KW_Bang "!") (MINGW)} {(SQ <"R: print mark for new blob">)} { (SQ <"\n"> <"\techo \"effluentish\" | git hash-object --stdin >expect &&\n"> <"\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n"> <"\tblob\n"> <"\tmark :1\n"> <"\tdata <<BLOB_END\n"> <"\teffluentish\n"> <"\tBLOB_END\n"> <"\tget-mark :1\n"> <"\tEOF\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(KW_Bang "!") (MINGW)} {(SQ <"R: print new blob">)} { (SQ <"\n"> <"\tblob=$(echo \"yep yep yep\" | git hash-object --stdin) &&\n"> <"\tcat >expect <<-EOF &&\n"> <"\t${blob} blob 12\n"> <"\tyep yep yep\n"> <"\n"> <"\tEOF\n"> <"\tgit fast-import --cat-blob-fd=6 6>actual <<-\\EOF &&\n"> <"\tblob\n"> <"\tmark :1\n"> <"\tdata <<BLOB_END\n"> <"\tyep yep yep\n"> <"\tBLOB_END\n"> <"\tcat-blob :1\n"> <"\tEOF\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(KW_Bang "!") (MINGW)} {(SQ <"R: print new blob by sha1">)} { (SQ <"\n"> <"\tblob=$(echo \"a new blob named by sha1\" | git hash-object --stdin) &&\n"> <"\tcat >expect <<-EOF &&\n"> <"\t${blob} blob 25\n"> <"\ta new blob named by sha1\n"> <"\n"> <"\tEOF\n"> <"\tgit fast-import --cat-blob-fd=6 6>actual <<-EOF &&\n"> <"\tblob\n"> <"\tdata <<BLOB_END\n"> <"\ta new blob named by sha1\n"> <"\tBLOB_END\n"> <"\tcat-blob $blob\n"> <"\tEOF\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"setup: big file">)} { (SQ <"\n"> <"\t(\n"> <"\t\techo \"the quick brown fox jumps over the lazy dog\" >big &&\n"> <"\t\tfor i in 1 2 3\n"> <"\t\tdo\n"> <"\t\t\tcat big big big big >bigger &&\n"> <"\t\t\tcat bigger bigger bigger bigger >big ||\n"> <"\t\t\texit\n"> <"\t\tdone\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: print two blobs to stdout">)} { (SQ <"\n"> <"\tblob1=$(git hash-object big) &&\n"> <"\tblob1_len=$(wc -c <big) &&\n"> <"\tblob2=$(echo hello | git hash-object --stdin) &&\n"> <"\t{\n"> <"\t\techo ${blob1} blob $blob1_len &&\n"> <"\t\tcat big &&\n"> <"\t\tcat <<-EOF\n"> <"\n"> <"\t\t${blob2} blob 6\n"> <"\t\thello\n"> <"\n"> <"\t\tEOF\n"> <"\t} >expect &&\n"> <"\t{\n"> <"\t\tcat <<-\\END_PART1 &&\n"> <"\t\t\tblob\n"> <"\t\t\tmark :1\n"> <"\t\t\tdata <<data_end\n"> <"\t\tEND_PART1\n"> <"\t\tcat big &&\n"> <"\t\tcat <<-\\EOF\n"> <"\t\t\tdata_end\n"> <"\t\t\tblob\n"> <"\t\t\tmark :2\n"> <"\t\t\tdata <<data_end\n"> <"\t\t\thello\n"> <"\t\t\tdata_end\n"> <"\t\t\tcat-blob :1\n"> <"\t\t\tcat-blob :2\n"> <"\t\tEOF\n"> <"\t} |\n"> <"\tgit fast-import >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(PIPE)} {(SQ <"R: copy using cat-file">)} { (SQ <"\n"> <"\texpect_id=$(git hash-object big) &&\n"> <"\texpect_len=$(wc -c <big) &&\n"> <"\techo $expect_id blob $expect_len >expect.response &&\n"> <"\n"> <"\trm -f blobs &&\n"> <"\tcat >frontend <<-\\FRONTEND_END &&\n"> <"\t#!/bin/sh\n"> <"\tFRONTEND_END\n"> <"\n"> <"\tmkfifo blobs &&\n"> <"\t(\n"> <"\t\texport GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GIT_COMMITTER_DATE &&\n"> <"\t\tcat <<-\\EOF &&\n"> <"\t\tfeature cat-blob\n"> <"\t\tblob\n"> <"\t\tmark :1\n"> <"\t\tdata <<BLOB\n"> <"\t\tEOF\n"> <"\t\tcat big &&\n"> <"\t\tcat <<-\\EOF &&\n"> <"\t\tBLOB\n"> <"\t\tcat-blob :1\n"> <"\t\tEOF\n"> <"\n"> <"\t\tread blob_id type size <&3 &&\n"> <"\t\techo \"$blob_id $type $size\" >response &&\n"> <"\t\ttest_copy_bytes $size >blob <&3 &&\n"> <"\t\tread newline <&3 &&\n"> <"\n"> <"\t\tcat <<-EOF &&\n"> <"\t\tcommit refs/heads/copied\n"> <"\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\t\tdata <<COMMIT\n"> <"\t\tcopy big file as file3\n"> <"\t\tCOMMIT\n"> <"\t\tM 644 inline file3\n"> <"\t\tdata <<BLOB\n"> <"\t\tEOF\n"> <"\t\tcat blob &&\n"> <"\t\techo BLOB\n"> <"\t) 3<blobs |\n"> <"\tgit fast-import --cat-blob-fd=3 3>blobs &&\n"> <"\tgit show copied:file3 >actual &&\n"> <"\ttest_cmp expect.response response &&\n"> <"\ttest_cmp big actual\n"> ) } ) (C {(test_expect_success)} {(PIPE)} {(SQ <"R: print blob mid-commit">)} { (SQ <"\n"> <"\trm -f blobs &&\n"> <"\techo \"A blob from _before_ the commit.\" >expect &&\n"> <"\tmkfifo blobs &&\n"> <"\t(\n"> <"\t\texec 3<blobs &&\n"> <"\t\tcat <<-EOF &&\n"> <"\t\tfeature cat-blob\n"> <"\t\tblob\n"> <"\t\tmark :1\n"> <"\t\tdata <<BLOB\n"> <"\t\tA blob from _before_ the commit.\n"> <"\t\tBLOB\n"> <"\t\tcommit refs/heads/temporary\n"> <"\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\t\tdata <<COMMIT\n"> <"\t\tEmpty commit\n"> <"\t\tCOMMIT\n"> <"\t\tcat-blob :1\n"> <"\t\tEOF\n"> <"\n"> <"\t\tread blob_id type size <&3 &&\n"> <"\t\ttest_copy_bytes $size >actual <&3 &&\n"> <"\t\tread newline <&3 &&\n"> <"\n"> <"\t\techo\n"> <"\t) |\n"> <"\tgit fast-import --cat-blob-fd=3 3>blobs &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(PIPE)} {(SQ <"R: print staged blob within commit">)} { (SQ <"\n"> <"\trm -f blobs &&\n"> <"\techo \"A blob from _within_ the commit.\" >expect &&\n"> <"\tmkfifo blobs &&\n"> <"\t(\n"> <"\t\texec 3<blobs &&\n"> <"\t\tcat <<-EOF &&\n"> <"\t\tfeature cat-blob\n"> <"\t\tcommit refs/heads/within\n"> <"\t\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\t\tdata <<COMMIT\n"> <"\t\tEmpty commit\n"> <"\t\tCOMMIT\n"> <"\t\tM 644 inline within\n"> <"\t\tdata <<BLOB\n"> <"\t\tA blob from _within_ the commit.\n"> <"\t\tBLOB\n"> <"\t\tEOF\n"> <"\n"> <"\t\tto_get=$(\n"> <"\t\t\techo \"A blob from _within_ the commit.\" |\n"> <"\t\t\tgit hash-object --stdin\n"> <"\t\t) &&\n"> <"\t\techo \"cat-blob $to_get\" &&\n"> <"\n"> <"\t\tread blob_id type size <&3 &&\n"> <"\t\ttest_copy_bytes $size >actual <&3 &&\n"> <"\t\tread newline <&3 &&\n"> <"\n"> <"\t\techo deleteall\n"> <"\t) |\n"> <"\tgit fast-import --cat-blob-fd=3 3>blobs &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: quiet option results in no stats being output">)} { (SQ <"\n"> <"\tcat >input <<-EOF &&\n"> <"\toption git quiet\n"> <"\tblob\n"> <"\tdata 3\n"> <"\thi\n"> <"\n"> <"\tEOF\n"> <"\n"> <"\tcat input | git fast-import 2> output &&\n"> <"\ttest_must_be_empty output\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: feature done means terminating \"done\" is mandatory">)} { (SQ <"\n"> <"\techo feature done | test_must_fail git fast-import &&\n"> <"\ttest_must_fail git fast-import --done </dev/null\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: terminating \"done\" with trailing gibberish is ok">)} { (SQ <"\n"> <"\tgit fast-import <<-\\EOF &&\n"> <"\tfeature done\n"> <"\tdone\n"> <"\ttrailing gibberish\n"> <"\tEOF\n"> <"\tgit fast-import <<-\\EOF\n"> <"\tdone\n"> <"\tmore trailing gibberish\n"> <"\tEOF\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: terminating \"done\" within commit">)} { (SQ <"\n"> <"\tcat >expect <<-\\EOF &&\n"> <"\tOBJID\n"> <"\t:000000 100644 OBJID OBJID A\thello.c\n"> <"\t:000000 100644 OBJID OBJID A\thello2.c\n"> <"\tEOF\n"> <"\tgit fast-import <<-EOF &&\n"> <"\tcommit refs/heads/done-ends\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<EOT\n"> <"\tCommit terminated by \"done\" command\n"> <"\tEOT\n"> <"\tM 100644 inline hello.c\n"> <"\tdata <<EOT\n"> <"\tHello, world.\n"> <"\tEOT\n"> <"\tC hello.c hello2.c\n"> <"\tdone\n"> <"\tEOF\n"> <"\tgit rev-list done-ends |\n"> <"\tgit diff-tree -r --stdin --root --always |\n"> <"\tsed -e \"s/$_x40/OBJID/g\" >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: die on unknown option">)} { (SQ <"\n"> <"\tcat >input <<-EOF &&\n"> <"\toption git non-existing-option\n"> <"\tEOF\n"> <"\n"> <"\ttest_must_fail git fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: unknown commandline options are rejected">)} {(SQ <"\\\n"> <"\ttest_must_fail git fast-import --non-existing-option < /dev/null\n">)} ) (C {(test_expect_success)} {(SQ <"R: die on invalid option argument">)} { (SQ <"\n"> <"\techo \"option git active-branches=-5\" |\n"> <"\ttest_must_fail git fast-import &&\n"> <"\techo \"option git depth=\" |\n"> <"\ttest_must_fail git fast-import &&\n"> <"\ttest_must_fail git fast-import --depth=\"5 elephants\" </dev/null\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: ignore non-git options">)} { (SQ <"\n"> <"\tcat >input <<-EOF &&\n"> <"\toption non-existing-vcs non-existing-option\n"> <"\tEOF\n"> <"\n"> <"\tgit fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: corrupt lines do not mess marks file">)} { (SQ <"\n"> <"\trm -f io.marks &&\n"> <"\tblob=$(echo hi | git hash-object --stdin) &&\n"> <"\tcat >expect <<-EOF &&\n"> <"\t:3 0000000000000000000000000000000000000000\n"> <"\t:1 $blob\n"> <"\t:2 $blob\n"> <"\tEOF\n"> <"\tcp expect io.marks &&\n"> <"\ttest_must_fail git fast-import --import-marks=io.marks --export-marks=io.marks <<-\\EOF &&\n"> <"\n"> <"\tEOF\n"> <"\ttest_cmp expect io.marks\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: blob bigger than threshold">)} { (SQ <"\n"> <"\tblobsize=$((2*1024*1024 + 53)) &&\n"> <"\ttest-genrandom bar $blobsize >expect &&\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/big-file\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tR - big file\n"> <"\tCOMMIT\n"> <"\n"> <"\tM 644 inline big1\n"> <"\tdata $blobsize\n"> <"\tINPUT_END\n"> <"\tcat expect >>input &&\n"> <"\tcat >>input <<-INPUT_END &&\n"> <"\tM 644 inline big2\n"> <"\tdata $blobsize\n"> <"\tINPUT_END\n"> <"\tcat expect >>input &&\n"> <"\techo >>input &&\n"> <"\n"> <"\ttest_create_repo R &&\n"> <"\tgit --git-dir=R/.git config fastimport.unpackLimit 0 &&\n"> <"\tgit --git-dir=R/.git fast-import --big-file-threshold=1 <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: verify created pack">)} {(SQ <"\n"> <"\t(\n"> <"\t\tcd R &&\n"> <"\t\tverify_packs -v > ../verify\n"> <"\t)\n">)} ) (C {(test_expect_success)} {(SQ <"R: verify written objects">)} { (SQ <"\n"> <"\tgit --git-dir=R/.git cat-file blob big-file:big1 >actual &&\n"> <"\ttest_cmp_bin expect actual &&\n"> <"\ta=$(git --git-dir=R/.git rev-parse big-file:big1) &&\n"> <"\tb=$(git --git-dir=R/.git rev-parse big-file:big2) &&\n"> <"\ttest $a = $b\n"> ) } ) (C {(test_expect_success)} {(SQ <"R: blob appears only once">)} {(SQ <"\n"> <"\tn=$(grep $a verify | wc -l) &&\n"> <"\ttest 1 = $n\n">)} ) (C {(test_expect_success)} {(SQ <"S: initialize for S tests">)} { (SQ <"\n"> <"\ttest_tick &&\n"> <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/S\n"> <"\tmark :301\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcommit 1\n"> <"\tCOMMIT\n"> <"\tM 100644 inline hello.c\n"> <"\tdata <<BLOB\n"> <"\tblob 1\n"> <"\tBLOB\n"> <"\n"> <"\tcommit refs/heads/S\n"> <"\tmark :302\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcommit 2\n"> <"\tCOMMIT\n"> <"\tfrom :301\n"> <"\tM 100644 inline hello.c\n"> <"\tdata <<BLOB\n"> <"\tblob 2\n"> <"\tBLOB\n"> <"\n"> <"\tblob\n"> <"\tmark :403\n"> <"\tdata <<BLOB\n"> <"\tblob 3\n"> <"\tBLOB\n"> <"\n"> <"\tblob\n"> <"\tmark :202\n"> <"\tdata <<BLOB\n"> <"\tnote 2\n"> <"\tBLOB\n"> <"\tINPUT_END\n"> <"\n"> <"\tgit fast-import --export-marks=marks <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"S: filemodify with garbage after mark must fail">)} { (SQ <"\n"> <"\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n"> <"\tcommit refs/heads/S\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcommit N\n"> <"\tCOMMIT\n"> <"\tM 100644 :403x hello.c\n"> <"\tEOF\n"> <"\tcat err &&\n"> <"\ttest_i18ngrep \"space after mark\" err\n"> ) } ) (C {(test_expect_success)} {(SQ <"S: filemodify with garbage after inline must fail">)} { (SQ <"\n"> <"\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n"> <"\tcommit refs/heads/S\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcommit N\n"> <"\tCOMMIT\n"> <"\tM 100644 inlineX hello.c\n"> <"\tdata <<BLOB\n"> <"\tinline\n"> <"\tBLOB\n"> <"\tEOF\n"> <"\tcat err &&\n"> <"\ttest_i18ngrep \"nvalid dataref\" err\n"> ) } ) (C {(test_expect_success)} {(SQ <"S: filemodify with garbage after sha1 must fail">)} { (SQ <"\n"> <"\tsha1=$(grep :403 marks | cut -d\\ -f2) &&\n"> <"\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n"> <"\tcommit refs/heads/S\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcommit N\n"> <"\tCOMMIT\n"> <"\tM 100644 ${sha1}x hello.c\n"> <"\tEOF\n"> <"\tcat err &&\n"> <"\ttest_i18ngrep \"space after SHA1\" err\n"> ) } ) (C {(test_expect_success)} {(SQ <"S: notemodify with garabge after mark dataref must fail">)} { (SQ <"\n"> <"\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n"> <"\tcommit refs/heads/S\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcommit S note dataref markref\n"> <"\tCOMMIT\n"> <"\tN :202x :302\n"> <"\tEOF\n"> <"\tcat err &&\n"> <"\ttest_i18ngrep \"space after mark\" err\n"> ) } ) (C {(test_expect_success)} {(SQ <"S: notemodify with garbage after inline dataref must fail">)} { (SQ <"\n"> <"\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n"> <"\tcommit refs/heads/S\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcommit S note dataref inline\n"> <"\tCOMMIT\n"> <"\tN inlineX :302\n"> <"\tdata <<BLOB\n"> <"\tnote blob\n"> <"\tBLOB\n"> <"\tEOF\n"> <"\tcat err &&\n"> <"\ttest_i18ngrep \"nvalid dataref\" err\n"> ) } ) (C {(test_expect_success)} {(SQ <"S: notemodify with garbage after sha1 dataref must fail">)} { (SQ <"\n"> <"\tsha1=$(grep :202 marks | cut -d\\ -f2) &&\n"> <"\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n"> <"\tcommit refs/heads/S\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcommit S note dataref sha1\n"> <"\tCOMMIT\n"> <"\tN ${sha1}x :302\n"> <"\tEOF\n"> <"\tcat err &&\n"> <"\ttest_i18ngrep \"space after SHA1\" err\n"> ) } ) (C {(test_expect_success)} {(SQ <"S: notemodify with garbage after mark commit-ish must fail">)} { (SQ <"\n"> <"\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n"> <"\tcommit refs/heads/Snotes\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcommit S note commit-ish\n"> <"\tCOMMIT\n"> <"\tN :202 :302x\n"> <"\tEOF\n"> <"\tcat err &&\n"> <"\ttest_i18ngrep \"after mark\" err\n"> ) } ) (C {(test_expect_success)} {(SQ <"S: from with garbage after mark must fail">)} { (SQ <"\n"> <"\ttest_must_fail \\\n"> <"\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err &&\n"> <"\tcommit refs/heads/S2\n"> <"\tmark :303\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcommit 3\n"> <"\tCOMMIT\n"> <"\tfrom :301x\n"> <"\tM 100644 :403 hello.c\n"> <"\tEOF\n"> <"\n"> <"\n"> <"\t# go create the commit, need it for merge test\n"> <"\tgit fast-import --import-marks=marks --export-marks=marks <<-EOF &&\n"> <"\tcommit refs/heads/S2\n"> <"\tmark :303\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tcommit 3\n"> <"\tCOMMIT\n"> <"\tfrom :301\n"> <"\tM 100644 :403 hello.c\n"> <"\tEOF\n"> <"\n"> <"\t# now evaluate the error\n"> <"\tcat err &&\n"> <"\ttest_i18ngrep \"after mark\" err\n"> ) } ) (C {(test_expect_success)} {(SQ <"S: merge with garbage after mark must fail">)} { (SQ <"\n"> <"\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n"> <"\tcommit refs/heads/S\n"> <"\tmark :304\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tmerge 4\n"> <"\tCOMMIT\n"> <"\tfrom :302\n"> <"\tmerge :303x\n"> <"\tM 100644 :403 hello.c\n"> <"\tEOF\n"> <"\tcat err &&\n"> <"\ttest_i18ngrep \"after mark\" err\n"> ) } ) (C {(test_expect_success)} {(SQ <"S: tag with garbage after mark must fail">)} { (SQ <"\n"> <"\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n"> <"\ttag refs/tags/Stag\n"> <"\tfrom :302x\n"> <"\ttagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<TAG\n"> <"\ttag S\n"> <"\tTAG\n"> <"\tEOF\n"> <"\tcat err &&\n"> <"\ttest_i18ngrep \"after mark\" err\n"> ) } ) (C {(test_expect_success)} {(SQ <"S: cat-blob with garbage after mark must fail">)} { (SQ <"\n"> <"\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n"> <"\tcat-blob :403x\n"> <"\tEOF\n"> <"\tcat err &&\n"> <"\ttest_i18ngrep \"after mark\" err\n"> ) } ) (C {(test_expect_success)} {(SQ <"S: ls with garbage after mark must fail">)} { (SQ <"\n"> <"\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n"> <"\tls :302x hello.c\n"> <"\tEOF\n"> <"\tcat err &&\n"> <"\ttest_i18ngrep \"space after mark\" err\n"> ) } ) (C {(test_expect_success)} {(SQ <"S: ls with garbage after sha1 must fail">)} { (SQ <"\n"> <"\tsha1=$(grep :302 marks | cut -d\\ -f2) &&\n"> <"\ttest_must_fail git fast-import --import-marks=marks <<-EOF 2>err &&\n"> <"\tls ${sha1}x hello.c\n"> <"\tEOF\n"> <"\tcat err &&\n"> <"\ttest_i18ngrep \"space after tree-ish\" err\n"> ) } ) (C {(test_expect_success)} {(SQ <"T: ls root tree">)} { (SQ <"\n"> <"\tsed -e \"s/Z\\$//\" >expect <<-EOF &&\n"> <"\t040000 tree $(git rev-parse S^{tree})\tZ\n"> <"\tEOF\n"> <"\tsha1=$(git rev-parse --verify S) &&\n"> <"\tgit fast-import --import-marks=marks <<-EOF >actual &&\n"> <"\tls $sha1 \"\"\n"> <"\tEOF\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"T: delete branch">)} { (SQ <"\n"> <"\tgit branch to-delete &&\n"> <"\tgit fast-import <<-EOF &&\n"> <"\treset refs/heads/to-delete\n"> <"\tfrom 0000000000000000000000000000000000000000\n"> <"\tEOF\n"> <"\ttest_must_fail git rev-parse --verify refs/heads/to-delete\n"> ) } ) (C {(test_expect_success)} {(SQ <"T: empty reset doesnt delete branch">)} { (SQ <"\n"> <"\tgit branch not-to-delete &&\n"> <"\tgit fast-import <<-EOF &&\n"> <"\treset refs/heads/not-to-delete\n"> <"\tEOF\n"> <"\tgit show-ref &&\n"> <"\tgit rev-parse --verify refs/heads/not-to-delete\n"> ) } ) (C {(test_expect_success)} {(SQ <"U: initialize for U tests">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/U\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\ttest setup\n"> <"\tCOMMIT\n"> <"\tM 100644 inline hello.c\n"> <"\tdata <<BLOB\n"> <"\tblob 1\n"> <"\tBLOB\n"> <"\tM 100644 inline good/night.txt\n"> <"\tdata <<BLOB\n"> <"\tsleep well\n"> <"\tBLOB\n"> <"\tM 100644 inline good/bye.txt\n"> <"\tdata <<BLOB\n"> <"\tau revoir\n"> <"\tBLOB\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tgit fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"U: filedelete file succeeds">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/U\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tdelete good/night.txt\n"> <"\tCOMMIT\n"> <"\tfrom refs/heads/U^0\n"> <"\tD good/night.txt\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tgit fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"U: validate file delete result">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> < "\t:100644 000000 2907ebb4bf85d91bf0716bb3bd8a68ef48d6da76 0000000000000000000000000000000000000000 D\tgood/night.txt\n" > <"\tEOF\n"> <"\n"> <"\tgit diff-tree -M -r U^1 U >actual &&\n"> <"\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"U: filedelete directory succeeds">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/U\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tdelete good dir\n"> <"\tCOMMIT\n"> <"\tfrom refs/heads/U^0\n"> <"\tD good\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tgit fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"U: validate directory delete result">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> < "\t:100644 000000 69cb75792f55123d8389c156b0b41c2ff00ed507 0000000000000000000000000000000000000000 D\tgood/bye.txt\n" > <"\tEOF\n"> <"\n"> <"\tgit diff-tree -M -r U^1 U >actual &&\n"> <"\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"U: filedelete root succeeds">)} { (SQ <"\n"> <"\tcat >input <<-INPUT_END &&\n"> <"\tcommit refs/heads/U\n"> <"\tcommitter $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n"> <"\tdata <<COMMIT\n"> <"\tmust succeed\n"> <"\tCOMMIT\n"> <"\tfrom refs/heads/U^0\n"> <"\tD \"\"\n"> <"\n"> <"\tINPUT_END\n"> <"\n"> <"\tgit fast-import <input\n"> ) } ) (C {(test_expect_success)} {(SQ <"U: validate root delete result">)} { (SQ <"\n"> <"\tcat >expect <<-EOF &&\n"> < "\t:100644 000000 c18147dc648481eeb65dc5e66628429a64843327 0000000000000000000000000000000000000000 D\thello.c\n" > <"\tEOF\n"> <"\n"> <"\tgit diff-tree -M -r U^1 U >actual &&\n"> <"\n"> <"\tcompare_diff_raw expect actual\n"> ) } ) (C {(test_done)}) ] )