1ee06bb3863956ea5566558ef00ec18a2de357b1
   1#!/bin/sh
   2
   3test_description='git-cvsimport basic tests'
   4. ./test-lib.sh
   5
   6if ! ( type cvs && type cvsps ) >/dev/null 2>&1
   7then
   8        test_expect_success 'skipping cvsimport tests, cvs/cvsps not found' ''
   9        test_done
  10        exit
  11fi
  12
  13CVSROOT=$(pwd)/cvsroot
  14export CVSROOT
  15# for clean cvsps cache
  16HOME=$(pwd)
  17export HOME
  18
  19test_expect_success 'setup cvsroot' 'cvs init'
  20
  21test_expect_success 'setup a cvs module' '
  22
  23        mkdir $CVSROOT/module &&
  24        cvs co -d module-cvs module &&
  25        cd module-cvs &&
  26        cat <<EOF >o_fortuna &&
  27O Fortuna
  28velut luna
  29statu variabilis,
  30
  31semper crescis
  32aut decrescis;
  33vita detestabilis
  34
  35nunc obdurat
  36et tunc curat
  37ludo mentis aciem,
  38
  39egestatem,
  40potestatem
  41dissolvit ut glaciem.
  42EOF
  43        cvs add o_fortuna &&
  44        cat <<EOF >message &&
  45add "O Fortuna" lyrics
  46
  47These public domain lyrics make an excellent sample text.
  48EOF
  49        cvs commit -F message &&
  50        cd ..
  51'
  52
  53test_expect_success 'import a trivial module' '
  54
  55        git cvsimport -a -z 0 -C module-git module &&
  56        git diff module-cvs/o_fortuna module-git/o_fortuna
  57
  58'
  59
  60test_expect_success 'update cvs module' '
  61
  62        cd module-cvs &&
  63        cat <<EOF >o_fortuna &&
  64O Fortune,
  65like the moon
  66you are changeable,
  67
  68ever waxing
  69and waning;
  70hateful life
  71
  72first oppresses
  73and then soothes
  74as fancy takes it;
  75
  76poverty
  77and power
  78it melts them like ice.
  79EOF
  80        cat <<EOF >message &&
  81translate to English
  82
  83My Latin is terrible.
  84EOF
  85        cvs commit -F message &&
  86        cd ..
  87'
  88
  89test_expect_success 'update git module' '
  90
  91        cd module-git &&
  92        git cvsimport -a -z 0 module &&
  93        git merge origin &&
  94        cd .. &&
  95        git diff module-cvs/o_fortuna module-git/o_fortuna
  96
  97'
  98
  99test_done