#!/bin/sh # # Copyright (c) 2007 Shawn Pearce # test_description='test git-fast-import utility' . ./test-lib.sh . ../diff-lib.sh ;# test-lib chdir's into trash file2_data='file2 second line of EOF' file3_data='EOF in 3rd file END' file4_data=abcd file4_len=4 file5_data='an inline file. we should see it later.' file6_data='#!/bin/sh echo "$@"' ### ### series A ### test_tick cat >input < $GIT_COMMITTER_DATE data <expect < $GIT_COMMITTER_DATE committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE initial EOF test_expect_success \ 'A: verify commit' \ 'git-cat-file commit master | sed 1d >actual && diff -u expect actual' cat >expect <actual && diff -u expect actual' echo "$file2_data" >expect test_expect_success \ 'A: verify file2' \ 'git-cat-file blob master:file2 >actual && diff -u expect actual' echo "$file3_data" >expect test_expect_success \ 'A: verify file3' \ 'git-cat-file blob master:file3 >actual && diff -u expect actual' printf "$file4_data" >expect test_expect_success \ 'A: verify file4' \ 'git-cat-file blob master:file4 >actual && diff -u expect actual' cat >expect <input < $GIT_COMMITTER_DATE data <input < $GIT_COMMITTER_DATE data <expect < $GIT_COMMITTER_DATE committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE second EOF test_expect_success \ 'C: verify commit' \ 'git-cat-file commit branch | sed 1d >actual && diff -u expect actual' cat >expect <actual test_expect_success \ 'C: validate rename result' \ 'compare_diff_raw expect actual' ### ### series D ### test_tick cat >input < $GIT_COMMITTER_DATE data <expect <actual test_expect_success \ 'D: validate new files added' \ 'compare_diff_raw expect actual' echo "$file5_data" >expect test_expect_success \ 'D: verify file5' \ 'git-cat-file blob branch:newdir/interesting >actual && diff -u expect actual' echo "$file6_data" >expect test_expect_success \ 'D: verify file6' \ 'git-cat-file blob branch:newdir/exec.sh >actual && diff -u expect actual' test_done