From: Junio C Hamano Date: Fri, 11 May 2012 18:17:49 +0000 (-0700) Subject: Merge branch 'js/fast-import-test-9300' into maint X-Git-Tag: v1.7.10.2~3 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/9a10117560316ed22099f74583e56c1cc7c41394?hp=-c Merge branch 'js/fast-import-test-9300' into maint By Johannes Sixt * js/fast-import-test-9300: t9300-fast-import: avoid 'exit' in test_expect_success snippets --- 9a10117560316ed22099f74583e56c1cc7c41394 diff --combined t/t9300-fast-import.sh index 924c884860,8d7be67dc5..7da0e8da7b --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@@ -24,6 -24,13 +24,13 @@@ head_c () ' - "$1" } + verify_packs () { + for p in .git/objects/pack/*.pack + do + git verify-pack "$@" "$p" || return + done + } + file2_data='file2 second line of EOF' @@@ -105,9 -112,10 +112,10 @@@ test_expect_success 'A: create pack from stdin' \ 'git fast-import --export-marks=marks.out expect < $GIT_COMMITTER_DATE @@@ -252,9 -260,11 +260,11 @@@ test_expect_success 'A: verify marks import does not crash' \ 'git fast-import --import-marks=marks.out expect <expect <expect < 1170778938 -0500 @@@ -669,9 -683,10 +683,10 @@@ test_expect_success fi fi ' - test_expect_success \ - 'F: verify pack' \ - 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done' + + test_expect_success 'F: verify pack' ' + verify_packs + ' cat >expect <expect <verify && - for p in R/.git/objects/pack/*.pack; - do - git verify-pack -v $p >>verify || exit; - done' + + test_expect_success 'R: verify created pack' ' + ( + cd R && + verify_packs -v > ../verify + ) + ' + test_expect_success \ 'R: verify written objects' \ 'git --git-dir=R/.git cat-file blob big-file:big1 >actual && @@@ -2635,291 -2655,4 +2655,291 @@@ test_expect_success 'n=$(grep $a verify | wc -l) && test 1 = $n' +### +### series S +### +# +# Make sure missing spaces and EOLs after mark references +# cause errors. +# +# Setup: +# +# 1--2--4 +# \ / +# -3- +# +# commit marks: 301, 302, 303, 304 +# blob marks: 403, 404, resp. +# note mark: 202 +# +# The error message when a space is missing not at the +# end of the line is: +# +# Missing space after .. +# +# or when extra characters come after the mark at the end +# of the line: +# +# Garbage after .. +# +# or when the dataref is neither "inline " or a known SHA1, +# +# Invalid dataref .. +# +test_tick + +cat >input < $GIT_COMMITTER_DATE +data < $GIT_COMMITTER_DATE +data <err && + commit refs/heads/S + committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + data <err && + commit refs/heads/S + committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + data <err && + commit refs/heads/S + committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + data <err && + commit refs/heads/S + committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + data <err && + commit refs/heads/S + committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + data <err && + commit refs/heads/S + committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + data <err && + commit refs/heads/Snotes + committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + data <err + commit refs/heads/S2 + mark :303 + committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + data < $GIT_COMMITTER_DATE + data <err && + commit refs/heads/S + mark :304 + committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + data <err && + tag refs/tags/Stag + from :302x + tagger $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + data <err && + cat-blob :403x + EOF + cat err && + test_i18ngrep "after mark" err +' + +# +# ls markref +# +test_expect_success 'S: ls with garbage after mark must fail' ' + test_must_fail git fast-import --import-marks=marks <<-EOF 2>err && + ls :302x hello.c + EOF + cat err && + test_i18ngrep "space after mark" err +' + +test_expect_success 'S: ls with garbage after sha1 must fail' ' + sha1=$(grep :302 marks | cut -d\ -f2) && + test_must_fail git fast-import --import-marks=marks <<-EOF 2>err && + ls ${sha1}x hello.c + EOF + cat err && + test_i18ngrep "space after tree-ish" err +' + test_done