mirror of
https://github.com/git/git.git
synced 2024-10-31 22:37:54 +01:00
Merge branch 'mo/cvs-server-updates'
Various git-cvsserver updates. * mo/cvs-server-updates: t9402: Use TABs for indentation t9402: Rename check.cvsCount and check.list t9402: Simplify git ls-tree t9402: Add missing &&; Code style t9402: No space after IO-redirection t9402: Dont use test_must_fail cvs t9402: improve check_end_tree() and check_end_full_tree() t9402: sed -i is not portable cvsserver Documentation: new cvs ... -r support cvsserver: add t9402 to test branch and tag refs cvsserver: support -r and sticky tags for most operations cvsserver: Add version awareness to argsfromdir cvsserver: generalize getmeta() to recognize commit refs cvsserver: implement req_Sticky and related utilities cvsserver: add misc commit lookup, file meta data, and file listing functions cvsserver: define a tag name character escape mechanism cvsserver: cleanup extra slashes in filename arguments cvsserver: factor out git-log parsing logic
This commit is contained in:
commit
6a3d05da55
3 changed files with 2210 additions and 329 deletions
|
@ -359,6 +359,43 @@ Operations supported
|
|||
|
||||
All the operations required for normal use are supported, including
|
||||
checkout, diff, status, update, log, add, remove, commit.
|
||||
|
||||
Most CVS command arguments that read CVS tags or revision numbers
|
||||
(typically -r) work, and also support any git refspec
|
||||
(tag, branch, commit ID, etc).
|
||||
However, CVS revision numbers for non-default branches are not well
|
||||
emulated, and cvs log does not show tags or branches at
|
||||
all. (Non-main-branch CVS revision numbers superficially resemble CVS
|
||||
revision numbers, but they actually encode a git commit ID directly,
|
||||
rather than represent the number of revisions since the branch point.)
|
||||
|
||||
Note that there are two ways to checkout a particular branch.
|
||||
As described elsewhere on this page, the "module" parameter
|
||||
of cvs checkout is interpreted as a branch name, and it becomes
|
||||
the main branch. It remains the main branch for a given sandbox
|
||||
even if you temporarily make another branch sticky with
|
||||
cvs update -r. Alternatively, the -r argument can indicate
|
||||
some other branch to actually checkout, even though the module
|
||||
is still the "main" branch. Tradeoffs (as currently
|
||||
implemented): Each new "module" creates a new database on disk with
|
||||
a history for the given module, and after the database is created,
|
||||
operations against that main branch are fast. Or alternatively,
|
||||
-r doesn't take any extra disk space, but may be significantly slower for
|
||||
many operations, like cvs update.
|
||||
|
||||
If you want to refer to a git refspec that has characters that are
|
||||
not allowed by CVS, you have two options. First, it may just work
|
||||
to supply the git refspec directly to the appropriate CVS -r argument;
|
||||
some CVS clients don't seem to do much sanity checking of the argument.
|
||||
Second, if that fails, you can use a special character escape mechanism
|
||||
that only uses characters that are valid in CVS tags. A sequence
|
||||
of 4 or 5 characters of the form (underscore (`"_"`), dash (`"-"`),
|
||||
one or two characters, and dash (`"-"`)) can encode various characters based
|
||||
on the one or two letters: `"s"` for slash (`"/"`), `"p"` for
|
||||
period (`"."`), `"u"` for underscore (`"_"`), or two hexadecimal digits
|
||||
for any byte value at all (typically an ASCII number, or perhaps a part
|
||||
of a UTF-8 encoded character).
|
||||
|
||||
Legacy monitoring operations are not supported (edit, watch and related).
|
||||
Exports and tagging (tags and branches) are not supported at this stage.
|
||||
|
||||
|
|
1951
git-cvsserver.perl
1951
git-cvsserver.perl
File diff suppressed because it is too large
Load diff
551
t/t9402-git-cvsserver-refs.sh
Executable file
551
t/t9402-git-cvsserver-refs.sh
Executable file
|
@ -0,0 +1,551 @@
|
|||
#!/bin/sh
|
||||
|
||||
test_description='git-cvsserver and git refspecs
|
||||
|
||||
tests ability for git-cvsserver to switch between and compare
|
||||
tags, branches and other git refspecs'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
#########
|
||||
|
||||
check_start_tree() {
|
||||
rm -f "$WORKDIR/list.expected"
|
||||
echo "start $1" >>"${WORKDIR}/check.log"
|
||||
}
|
||||
|
||||
check_file() {
|
||||
sandbox="$1"
|
||||
file="$2"
|
||||
ver="$3"
|
||||
GIT_DIR=$SERVERDIR git show "${ver}:${file}" \
|
||||
>"$WORKDIR/check.got" 2>"$WORKDIR/check.stderr"
|
||||
test_cmp "$WORKDIR/check.got" "$sandbox/$file"
|
||||
stat=$?
|
||||
echo "check_file $sandbox $file $ver : $stat" >>"$WORKDIR/check.log"
|
||||
echo "$file" >>"$WORKDIR/list.expected"
|
||||
return $stat
|
||||
}
|
||||
|
||||
check_end_tree() {
|
||||
sandbox="$1" &&
|
||||
find "$sandbox" -name CVS -prune -o -type f -print >"$WORKDIR/list.actual" &&
|
||||
sort <"$WORKDIR/list.expected" >expected &&
|
||||
sort <"$WORKDIR/list.actual" | sed -e "s%cvswork/%%" >actual &&
|
||||
test_cmp expected actual &&
|
||||
rm expected actual
|
||||
}
|
||||
|
||||
check_end_full_tree() {
|
||||
sandbox="$1" &&
|
||||
sort <"$WORKDIR/list.expected" >expected &&
|
||||
find "$sandbox" -name CVS -prune -o -type f -print |
|
||||
sed -e "s%$sandbox/%%" | sort >act1 &&
|
||||
test_cmp expected act1 &&
|
||||
git ls-tree --name-only -r "$2" | sort >act2 &&
|
||||
test_cmp expected act2 &&
|
||||
rm expected act1 act2
|
||||
}
|
||||
|
||||
#########
|
||||
|
||||
check_diff() {
|
||||
diffFile="$1"
|
||||
vOld="$2"
|
||||
vNew="$3"
|
||||
rm -rf diffSandbox
|
||||
git clone -q -n . diffSandbox &&
|
||||
(
|
||||
cd diffSandbox &&
|
||||
git checkout "$vOld" &&
|
||||
git apply -p0 --index <"../$diffFile" &&
|
||||
git diff --exit-code "$vNew"
|
||||
) >check_diff_apply.out 2>&1
|
||||
}
|
||||
|
||||
#########
|
||||
|
||||
cvs >/dev/null 2>&1
|
||||
if test $? -ne 1
|
||||
then
|
||||
skip_all='skipping git-cvsserver tests, cvs not found'
|
||||
test_done
|
||||
fi
|
||||
if ! test_have_prereq PERL
|
||||
then
|
||||
skip_all='skipping git-cvsserver tests, perl not available'
|
||||
test_done
|
||||
fi
|
||||
"$PERL_PATH" -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
|
||||
skip_all='skipping git-cvsserver tests, Perl SQLite interface unavailable'
|
||||
test_done
|
||||
}
|
||||
|
||||
unset GIT_DIR GIT_CONFIG
|
||||
WORKDIR=$(pwd)
|
||||
SERVERDIR=$(pwd)/gitcvs.git
|
||||
git_config="$SERVERDIR/config"
|
||||
CVSROOT=":fork:$SERVERDIR"
|
||||
CVSWORK="$(pwd)/cvswork"
|
||||
CVS_SERVER=git-cvsserver
|
||||
export CVSROOT CVS_SERVER
|
||||
|
||||
rm -rf "$CVSWORK" "$SERVERDIR"
|
||||
test_expect_success 'setup v1, b1' '
|
||||
echo "Simple text file" >textfile.c &&
|
||||
echo "t2" >t2 &&
|
||||
mkdir adir &&
|
||||
echo "adir/afile line1" >adir/afile &&
|
||||
echo "adir/afile line2" >>adir/afile &&
|
||||
echo "adir/afile line3" >>adir/afile &&
|
||||
echo "adir/afile line4" >>adir/afile &&
|
||||
echo "adir/a2file" >>adir/a2file &&
|
||||
mkdir adir/bdir &&
|
||||
echo "adir/bdir/bfile line 1" >adir/bdir/bfile &&
|
||||
echo "adir/bdir/bfile line 2" >>adir/bdir/bfile &&
|
||||
echo "adir/bdir/b2file" >adir/bdir/b2file &&
|
||||
git add textfile.c t2 adir &&
|
||||
git commit -q -m "First Commit (v1)" &&
|
||||
git tag v1 &&
|
||||
git branch b1 &&
|
||||
git clone -q --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 &&
|
||||
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
|
||||
GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log"
|
||||
'
|
||||
|
||||
rm -rf cvswork
|
||||
test_expect_success 'cvs co v1' '
|
||||
cvs -f -Q co -r v1 -d cvswork master >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork &&
|
||||
check_file cvswork textfile.c v1 &&
|
||||
check_file cvswork t2 v1 &&
|
||||
check_file cvswork adir/afile v1 &&
|
||||
check_file cvswork adir/a2file v1 &&
|
||||
check_file cvswork adir/bdir/bfile v1 &&
|
||||
check_file cvswork adir/bdir/b2file v1 &&
|
||||
check_end_tree cvswork
|
||||
'
|
||||
|
||||
rm -rf cvswork
|
||||
test_expect_success 'cvs co b1' '
|
||||
cvs -f co -r b1 -d cvswork master >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork &&
|
||||
check_file cvswork textfile.c v1 &&
|
||||
check_file cvswork t2 v1 &&
|
||||
check_file cvswork adir/afile v1 &&
|
||||
check_file cvswork adir/a2file v1 &&
|
||||
check_file cvswork adir/bdir/bfile v1 &&
|
||||
check_file cvswork adir/bdir/b2file v1 &&
|
||||
check_end_tree cvswork
|
||||
'
|
||||
|
||||
test_expect_success 'cvs co b1 [cvswork3]' '
|
||||
cvs -f co -r b1 -d cvswork3 master >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork3 &&
|
||||
check_file cvswork3 textfile.c v1 &&
|
||||
check_file cvswork3 t2 v1 &&
|
||||
check_file cvswork3 adir/afile v1 &&
|
||||
check_file cvswork3 adir/a2file v1 &&
|
||||
check_file cvswork3 adir/bdir/bfile v1 &&
|
||||
check_file cvswork3 adir/bdir/b2file v1 &&
|
||||
check_end_full_tree cvswork3 v1
|
||||
'
|
||||
|
||||
test_expect_success 'edit cvswork3 and save diff' '
|
||||
(
|
||||
cd cvswork3 &&
|
||||
sed -e "s/line1/line1 - data/" adir/afile >adir/afileNEW &&
|
||||
mv -f adir/afileNEW adir/afile &&
|
||||
echo "afile5" >adir/afile5 &&
|
||||
rm t2 &&
|
||||
cvs -f add adir/afile5 &&
|
||||
cvs -f rm t2 &&
|
||||
! cvs -f diff -N -u >"$WORKDIR/cvswork3edit.diff"
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success 'setup v1.2 on b1' '
|
||||
git checkout b1 &&
|
||||
echo "new v1.2" >t3 &&
|
||||
rm t2 &&
|
||||
sed -e "s/line3/line3 - more data/" adir/afile >adir/afileNEW &&
|
||||
mv -f adir/afileNEW adir/afile &&
|
||||
rm adir/a2file &&
|
||||
echo "a3file" >>adir/a3file &&
|
||||
echo "bfile line 3" >>adir/bdir/bfile &&
|
||||
rm adir/bdir/b2file &&
|
||||
echo "b3file" >adir/bdir/b3file &&
|
||||
mkdir cdir &&
|
||||
echo "cdir/cfile" >cdir/cfile &&
|
||||
git add -A cdir adir t3 t2 &&
|
||||
git commit -q -m 'v1.2' &&
|
||||
git tag v1.2 &&
|
||||
git push --tags gitcvs.git b1:b1
|
||||
'
|
||||
|
||||
test_expect_success 'cvs -f up (on b1 adir)' '
|
||||
( cd cvswork/adir && cvs -f up -d ) >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork &&
|
||||
check_file cvswork textfile.c v1 &&
|
||||
check_file cvswork t2 v1 &&
|
||||
check_file cvswork adir/afile v1.2 &&
|
||||
check_file cvswork adir/a3file v1.2 &&
|
||||
check_file cvswork adir/bdir/bfile v1.2 &&
|
||||
check_file cvswork adir/bdir/b3file v1.2 &&
|
||||
check_end_tree cvswork
|
||||
'
|
||||
|
||||
test_expect_success 'cvs up (on b1 /)' '
|
||||
( cd cvswork && cvs -f up -d ) >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork &&
|
||||
check_file cvswork textfile.c v1.2 &&
|
||||
check_file cvswork t3 v1.2 &&
|
||||
check_file cvswork adir/afile v1.2 &&
|
||||
check_file cvswork adir/a3file v1.2 &&
|
||||
check_file cvswork adir/bdir/bfile v1.2 &&
|
||||
check_file cvswork adir/bdir/b3file v1.2 &&
|
||||
check_file cvswork cdir/cfile v1.2 &&
|
||||
check_end_tree cvswork
|
||||
'
|
||||
|
||||
# Make sure "CVS/Tag" files didn't get messed up:
|
||||
test_expect_success 'cvs up (on b1 /) (again; check CVS/Tag files)' '
|
||||
( cd cvswork && cvs -f up -d ) >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork &&
|
||||
check_file cvswork textfile.c v1.2 &&
|
||||
check_file cvswork t3 v1.2 &&
|
||||
check_file cvswork adir/afile v1.2 &&
|
||||
check_file cvswork adir/a3file v1.2 &&
|
||||
check_file cvswork adir/bdir/bfile v1.2 &&
|
||||
check_file cvswork adir/bdir/b3file v1.2 &&
|
||||
check_file cvswork cdir/cfile v1.2 &&
|
||||
check_end_tree cvswork
|
||||
'
|
||||
|
||||
# update to another version:
|
||||
test_expect_success 'cvs up -r v1' '
|
||||
( cd cvswork && cvs -f up -r v1 ) >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork &&
|
||||
check_file cvswork textfile.c v1 &&
|
||||
check_file cvswork t2 v1 &&
|
||||
check_file cvswork adir/afile v1 &&
|
||||
check_file cvswork adir/a2file v1 &&
|
||||
check_file cvswork adir/bdir/bfile v1 &&
|
||||
check_file cvswork adir/bdir/b2file v1 &&
|
||||
check_end_tree cvswork
|
||||
'
|
||||
|
||||
test_expect_success 'cvs up' '
|
||||
( cd cvswork && cvs -f up ) >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork &&
|
||||
check_file cvswork textfile.c v1 &&
|
||||
check_file cvswork t2 v1 &&
|
||||
check_file cvswork adir/afile v1 &&
|
||||
check_file cvswork adir/a2file v1 &&
|
||||
check_file cvswork adir/bdir/bfile v1 &&
|
||||
check_file cvswork adir/bdir/b2file v1 &&
|
||||
check_end_tree cvswork
|
||||
'
|
||||
|
||||
test_expect_success 'cvs up (again; check CVS/Tag files)' '
|
||||
( cd cvswork && cvs -f up -d ) >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork &&
|
||||
check_file cvswork textfile.c v1 &&
|
||||
check_file cvswork t2 v1 &&
|
||||
check_file cvswork adir/afile v1 &&
|
||||
check_file cvswork adir/a2file v1 &&
|
||||
check_file cvswork adir/bdir/bfile v1 &&
|
||||
check_file cvswork adir/bdir/b2file v1 &&
|
||||
check_end_tree cvswork
|
||||
'
|
||||
|
||||
test_expect_success 'setup simple b2' '
|
||||
git branch b2 v1 &&
|
||||
git push --tags gitcvs.git b2:b2
|
||||
'
|
||||
|
||||
test_expect_success 'cvs co b2 [into cvswork2]' '
|
||||
cvs -f co -r b2 -d cvswork2 master >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork &&
|
||||
check_file cvswork textfile.c v1 &&
|
||||
check_file cvswork t2 v1 &&
|
||||
check_file cvswork adir/afile v1 &&
|
||||
check_file cvswork adir/a2file v1 &&
|
||||
check_file cvswork adir/bdir/bfile v1 &&
|
||||
check_file cvswork adir/bdir/b2file v1 &&
|
||||
check_end_tree cvswork
|
||||
'
|
||||
|
||||
test_expect_success 'root dir edit [cvswork2]' '
|
||||
(
|
||||
cd cvswork2 && echo "Line 2" >>textfile.c &&
|
||||
! cvs -f diff -u >"$WORKDIR/cvsEdit1.diff" &&
|
||||
cvs -f commit -m "edit textfile.c" textfile.c
|
||||
) >cvsEdit1.log 2>&1
|
||||
'
|
||||
|
||||
test_expect_success 'root dir rm file [cvswork2]' '
|
||||
(
|
||||
cd cvswork2 &&
|
||||
cvs -f rm -f t2 &&
|
||||
cvs -f diff -u >../cvsEdit2-empty.diff &&
|
||||
! cvs -f diff -N -u >"$WORKDIR/cvsEdit2-N.diff" &&
|
||||
cvs -f commit -m "rm t2"
|
||||
) >cvsEdit2.log 2>&1
|
||||
'
|
||||
|
||||
test_expect_success 'subdir edit/add/rm files [cvswork2]' '
|
||||
(
|
||||
cd cvswork2 &&
|
||||
sed -e "s/line 1/line 1 (v2)/" adir/bdir/bfile >adir/bdir/bfileNEW &&
|
||||
mv -f adir/bdir/bfileNEW adir/bdir/bfile &&
|
||||
rm adir/bdir/b2file &&
|
||||
cd adir &&
|
||||
cvs -f rm bdir/b2file &&
|
||||
echo "4th file" >bdir/b4file &&
|
||||
cvs -f add bdir/b4file &&
|
||||
! cvs -f diff -N -u >"$WORKDIR/cvsEdit3.diff" &&
|
||||
git fetch gitcvs.git b2:b2 &&
|
||||
(
|
||||
cd .. &&
|
||||
! cvs -f diff -u -N -r v1.2 >"$WORKDIR/cvsEdit3-v1.2.diff" &&
|
||||
! cvs -f diff -u -N -r v1.2 -r v1 >"$WORKDIR/cvsEdit3-v1.2-v1.diff"
|
||||
) &&
|
||||
cvs -f commit -m "various add/rm/edit"
|
||||
) >cvs.log 2>&1
|
||||
'
|
||||
|
||||
test_expect_success 'validate result of edits [cvswork2]' '
|
||||
git fetch gitcvs.git b2:b2 &&
|
||||
git tag v2 b2 &&
|
||||
git push --tags gitcvs.git b2:b2 &&
|
||||
check_start_tree cvswork2 &&
|
||||
check_file cvswork2 textfile.c v2 &&
|
||||
check_file cvswork2 adir/afile v2 &&
|
||||
check_file cvswork2 adir/a2file v2 &&
|
||||
check_file cvswork2 adir/bdir/bfile v2 &&
|
||||
check_file cvswork2 adir/bdir/b4file v2 &&
|
||||
check_end_full_tree cvswork2 v2
|
||||
'
|
||||
|
||||
test_expect_success 'validate basic diffs saved during above cvswork2 edits' '
|
||||
test $(grep Index: cvsEdit1.diff | wc -l) = 1 &&
|
||||
test ! -s cvsEdit2-empty.diff &&
|
||||
test $(grep Index: cvsEdit2-N.diff | wc -l) = 1 &&
|
||||
test $(grep Index: cvsEdit3.diff | wc -l) = 3 &&
|
||||
rm -rf diffSandbox &&
|
||||
git clone -q -n . diffSandbox &&
|
||||
(
|
||||
cd diffSandbox &&
|
||||
git checkout v1 &&
|
||||
git apply -p0 --index <"$WORKDIR/cvsEdit1.diff" &&
|
||||
git apply -p0 --index <"$WORKDIR/cvsEdit2-N.diff" &&
|
||||
git apply -p0 --directory=adir --index <"$WORKDIR/cvsEdit3.diff" &&
|
||||
git diff --exit-code v2
|
||||
) >"check_diff_apply.out" 2>&1
|
||||
'
|
||||
|
||||
test_expect_success 'validate v1.2 diff saved during last cvswork2 edit' '
|
||||
test $(grep Index: cvsEdit3-v1.2.diff | wc -l) = 9 &&
|
||||
check_diff cvsEdit3-v1.2.diff v1.2 v2
|
||||
'
|
||||
|
||||
test_expect_success 'validate v1.2 v1 diff saved during last cvswork2 edit' '
|
||||
test $(grep Index: cvsEdit3-v1.2-v1.diff | wc -l) = 9 &&
|
||||
check_diff cvsEdit3-v1.2-v1.diff v1.2 v1
|
||||
'
|
||||
|
||||
test_expect_success 'cvs up [cvswork2]' '
|
||||
( cd cvswork2 && cvs -f up ) >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork2 &&
|
||||
check_file cvswork2 textfile.c v2 &&
|
||||
check_file cvswork2 adir/afile v2 &&
|
||||
check_file cvswork2 adir/a2file v2 &&
|
||||
check_file cvswork2 adir/bdir/bfile v2 &&
|
||||
check_file cvswork2 adir/bdir/b4file v2 &&
|
||||
check_end_full_tree cvswork2 v2
|
||||
'
|
||||
|
||||
test_expect_success 'cvs up -r b2 [back to cvswork]' '
|
||||
( cd cvswork && cvs -f up -r b2 ) >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork &&
|
||||
check_file cvswork textfile.c v2 &&
|
||||
check_file cvswork adir/afile v2 &&
|
||||
check_file cvswork adir/a2file v2 &&
|
||||
check_file cvswork adir/bdir/bfile v2 &&
|
||||
check_file cvswork adir/bdir/b4file v2 &&
|
||||
check_end_full_tree cvswork v2
|
||||
'
|
||||
|
||||
test_expect_success 'cvs up -r b1' '
|
||||
( cd cvswork && cvs -f up -r b1 ) >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork &&
|
||||
check_file cvswork textfile.c v1.2 &&
|
||||
check_file cvswork t3 v1.2 &&
|
||||
check_file cvswork adir/afile v1.2 &&
|
||||
check_file cvswork adir/a3file v1.2 &&
|
||||
check_file cvswork adir/bdir/bfile v1.2 &&
|
||||
check_file cvswork adir/bdir/b3file v1.2 &&
|
||||
check_file cvswork cdir/cfile v1.2 &&
|
||||
check_end_full_tree cvswork v1.2
|
||||
'
|
||||
|
||||
test_expect_success 'cvs up -A' '
|
||||
( cd cvswork && cvs -f up -A ) >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork &&
|
||||
check_file cvswork textfile.c v1 &&
|
||||
check_file cvswork t2 v1 &&
|
||||
check_file cvswork adir/afile v1 &&
|
||||
check_file cvswork adir/a2file v1 &&
|
||||
check_file cvswork adir/bdir/bfile v1 &&
|
||||
check_file cvswork adir/bdir/b2file v1 &&
|
||||
check_end_full_tree cvswork v1
|
||||
'
|
||||
|
||||
test_expect_success 'cvs up (check CVS/Tag files)' '
|
||||
( cd cvswork && cvs -f up ) >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork &&
|
||||
check_file cvswork textfile.c v1 &&
|
||||
check_file cvswork t2 v1 &&
|
||||
check_file cvswork adir/afile v1 &&
|
||||
check_file cvswork adir/a2file v1 &&
|
||||
check_file cvswork adir/bdir/bfile v1 &&
|
||||
check_file cvswork adir/bdir/b2file v1 &&
|
||||
check_end_full_tree cvswork v1
|
||||
'
|
||||
|
||||
# This is not really legal CVS, but it seems to work anyway:
|
||||
test_expect_success 'cvs up -r heads/b1' '
|
||||
( cd cvswork && cvs -f up -r heads/b1 ) >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork &&
|
||||
check_file cvswork textfile.c v1.2 &&
|
||||
check_file cvswork t3 v1.2 &&
|
||||
check_file cvswork adir/afile v1.2 &&
|
||||
check_file cvswork adir/a3file v1.2 &&
|
||||
check_file cvswork adir/bdir/bfile v1.2 &&
|
||||
check_file cvswork adir/bdir/b3file v1.2 &&
|
||||
check_file cvswork cdir/cfile v1.2 &&
|
||||
check_end_full_tree cvswork v1.2
|
||||
'
|
||||
|
||||
# But this should work even if CVS client checks -r more carefully:
|
||||
test_expect_success 'cvs up -r heads_-s-b2 (cvsserver escape mechanism)' '
|
||||
( cd cvswork && cvs -f up -r heads_-s-b2 ) >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork &&
|
||||
check_file cvswork textfile.c v2 &&
|
||||
check_file cvswork adir/afile v2 &&
|
||||
check_file cvswork adir/a2file v2 &&
|
||||
check_file cvswork adir/bdir/bfile v2 &&
|
||||
check_file cvswork adir/bdir/b4file v2 &&
|
||||
check_end_full_tree cvswork v2
|
||||
'
|
||||
|
||||
v1hash=$(git rev-parse v1)
|
||||
test_expect_success 'cvs up -r $(git rev-parse v1)' '
|
||||
test -n "$v1hash" &&
|
||||
( cd cvswork && cvs -f up -r "$v1hash" ) >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork &&
|
||||
check_file cvswork textfile.c v1 &&
|
||||
check_file cvswork t2 v1 &&
|
||||
check_file cvswork adir/afile v1 &&
|
||||
check_file cvswork adir/a2file v1 &&
|
||||
check_file cvswork adir/bdir/bfile v1 &&
|
||||
check_file cvswork adir/bdir/b2file v1 &&
|
||||
check_end_full_tree cvswork v1
|
||||
'
|
||||
|
||||
test_expect_success 'cvs diff -r v1 -u' '
|
||||
( cd cvswork && cvs -f diff -r v1 -u ) >cvsDiff.out 2>cvs.log &&
|
||||
test ! -s cvsDiff.out &&
|
||||
test ! -s cvs.log
|
||||
'
|
||||
|
||||
test_expect_success 'cvs diff -N -r v2 -u' '
|
||||
( cd cvswork && ! cvs -f diff -N -r v2 -u ) >cvsDiff.out 2>cvs.log &&
|
||||
test ! -s cvs.log &&
|
||||
test -s cvsDiff.out &&
|
||||
check_diff cvsDiff.out v2 v1 >check_diff.out 2>&1
|
||||
'
|
||||
|
||||
test_expect_success 'cvs diff -N -r v2 -r v1.2' '
|
||||
( cd cvswork && ! cvs -f diff -N -r v2 -r v1.2 -u ) >cvsDiff.out 2>cvs.log &&
|
||||
test ! -s cvs.log &&
|
||||
test -s cvsDiff.out &&
|
||||
check_diff cvsDiff.out v2 v1.2 >check_diff.out 2>&1
|
||||
'
|
||||
|
||||
test_expect_success 'apply early [cvswork3] diff to b3' '
|
||||
git clone -q . gitwork3 &&
|
||||
(
|
||||
cd gitwork3 &&
|
||||
git checkout -b b3 v1 &&
|
||||
git apply -p0 --index <"$WORKDIR/cvswork3edit.diff" &&
|
||||
git commit -m "cvswork3 edits applied"
|
||||
) &&
|
||||
git fetch gitwork3 b3:b3 &&
|
||||
git tag v3 b3
|
||||
'
|
||||
|
||||
test_expect_success 'check [cvswork3] diff' '
|
||||
( cd cvswork3 && ! cvs -f diff -N -u ) >"$WORKDIR/cvsDiff.out" 2>cvs.log &&
|
||||
test ! -s cvs.log &&
|
||||
test -s cvsDiff.out &&
|
||||
test $(grep Index: cvsDiff.out | wc -l) = 3 &&
|
||||
test_cmp cvsDiff.out cvswork3edit.diff &&
|
||||
check_diff cvsDiff.out v1 v3 >check_diff.out 2>&1
|
||||
'
|
||||
|
||||
test_expect_success 'merge early [cvswork3] b3 with b1' '
|
||||
( cd gitwork3 && git merge "message" HEAD b1 ) &&
|
||||
git fetch gitwork3 b3:b3 &&
|
||||
git tag v3merged b3 &&
|
||||
git push --tags gitcvs.git b3:b3
|
||||
'
|
||||
|
||||
# This test would fail if cvsserver properly created a ".#afile"* file
|
||||
# for the merge.
|
||||
# TODO: Validate that the .# file was saved properly, and then
|
||||
# delete/ignore it when checking the tree.
|
||||
test_expect_success 'cvs up dirty [cvswork3]' '
|
||||
(
|
||||
cd cvswork3 &&
|
||||
cvs -f up &&
|
||||
! cvs -f diff -N -u >"$WORKDIR/cvsDiff.out"
|
||||
) >cvs.log 2>&1 &&
|
||||
test -s cvsDiff.out &&
|
||||
test $(grep Index: cvsDiff.out | wc -l) = 2 &&
|
||||
check_start_tree cvswork3 &&
|
||||
check_file cvswork3 textfile.c v3merged &&
|
||||
check_file cvswork3 t3 v3merged &&
|
||||
check_file cvswork3 adir/afile v3merged &&
|
||||
check_file cvswork3 adir/a3file v3merged &&
|
||||
check_file cvswork3 adir/afile5 v3merged &&
|
||||
check_file cvswork3 adir/bdir/bfile v3merged &&
|
||||
check_file cvswork3 adir/bdir/b3file v3merged &&
|
||||
check_file cvswork3 cdir/cfile v3merged &&
|
||||
check_end_full_tree cvswork3 v3merged
|
||||
'
|
||||
|
||||
# TODO: test cvs status
|
||||
|
||||
test_expect_success 'cvs commit [cvswork3]' '
|
||||
(
|
||||
cd cvswork3 &&
|
||||
cvs -f commit -m "dirty sandbox after auto-merge"
|
||||
) >cvs.log 2>&1 &&
|
||||
check_start_tree cvswork3 &&
|
||||
check_file cvswork3 textfile.c v3merged &&
|
||||
check_file cvswork3 t3 v3merged &&
|
||||
check_file cvswork3 adir/afile v3merged &&
|
||||
check_file cvswork3 adir/a3file v3merged &&
|
||||
check_file cvswork3 adir/afile5 v3merged &&
|
||||
check_file cvswork3 adir/bdir/bfile v3merged &&
|
||||
check_file cvswork3 adir/bdir/b3file v3merged &&
|
||||
check_file cvswork3 cdir/cfile v3merged &&
|
||||
check_end_full_tree cvswork3 v3merged &&
|
||||
git fetch gitcvs.git b3:b4 &&
|
||||
git tag v4.1 b4 &&
|
||||
git diff --exit-code v4.1 v3merged >check_diff_apply.out 2>&1
|
||||
'
|
||||
|
||||
test_done
|
Loading…
Reference in a new issue