#!/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 && git diff expect actual' cat >expect <actual && git diff expect actual' echo "$file2_data" >expect test_expect_success \ 'A: verify file2' \ 'git cat-file blob master:file2 >actual && git diff expect actual' echo "$file3_data" >expect test_expect_success \ 'A: verify file3' \ 'git cat-file blob master:file3 >actual && git diff expect actual' printf "$file4_data" >expect test_expect_success \ 'A: verify file4' \ 'git cat-file blob master:file4 >actual && git diff expect actual' cat >expect <input < $GIT_COMMITTER_DATE data <expect <actual test_expect_success \ 'A: verify diff' \ 'compare_diff_raw expect actual && test `git rev-parse --verify master:file2` \ = `git rev-parse --verify verify--import-marks:copy-of-file2`' ### ### series B ### test_tick cat >input < $GIT_COMMITTER_DATE data <input < $GIT_COMMITTER_DATE data <input < $GIT_COMMITTER_DATE data <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 && git diff 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 && git diff expect actual' echo "$file6_data" >expect test_expect_success \ 'D: verify file6' \ 'git cat-file blob branch:newdir/exec.sh >actual && git diff expect actual' ### ### series E ### cat >input < Tue Feb 6 11:22:18 2007 -0500 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> Tue Feb 6 12:35:02 2007 -0500 data <expect < 1170778938 -0500 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1170783302 -0500 RFC 2822 type date EOF test_expect_success \ 'E: verify commit' \ 'git cat-file commit branch | sed 1,2d >actual && git diff expect actual' ### ### series F ### old_branch=`git rev-parse --verify branch^0` test_tick cat >input < $GIT_COMMITTER_DATE data <expect < $GIT_COMMITTER_DATE committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE losing things already? EOF test_expect_success \ 'F: verify other commit' \ 'git cat-file commit other >actual && git diff expect actual' ### ### series G ### old_branch=`git rev-parse --verify branch^0` test_tick cat >input < $GIT_COMMITTER_DATE data <input < $GIT_COMMITTER_DATE data <expect <actual test_expect_success \ 'H: validate old files removed, new files added' \ 'compare_diff_raw expect actual' echo "$file5_data" >expect test_expect_success \ 'H: verify file' \ 'git cat-file blob H:h/e/l/lo >actual && git diff expect actual' ### ### series I ### cat >input < $GIT_COMMITTER_DATE data <expect <actual && git diff expect actual' ### ### series J ### cat >input < $GIT_COMMITTER_DATE data < $GIT_COMMITTER_DATE data <input < $GIT_COMMITTER_DATE data < $GIT_COMMITTER_DATE data <input < $GIT_COMMITTER_DATE data < $GIT_COMMITTER_DATE data <expect <output && git diff expect output' ### ### series M ### test_tick cat >input < $GIT_COMMITTER_DATE data <expect <actual && compare_diff_raw expect actual' cat >input < $GIT_COMMITTER_DATE data <expect <actual && compare_diff_raw expect actual' cat >input < $GIT_COMMITTER_DATE data <expect <actual && compare_diff_raw expect actual' ### ### series N ### test_tick cat >input < $GIT_COMMITTER_DATE data <expect <actual && compare_diff_raw expect actual' cat >input < $GIT_COMMITTER_DATE data < $GIT_COMMITTER_DATE data <expect <actual && compare_diff_raw expect actual' cat >input < $GIT_COMMITTER_DATE data <input < $GIT_COMMITTER_DATE # $GIT_COMMITTER_NAME has inserted here for his benefit. data <