2012-10-14 07:42:32 +02:00
|
|
|
#!/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'
|
|
|
|
|
2020-11-19 00:44:42 +01:00
|
|
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
tests: mark tests relying on the current default for `init.defaultBranch`
In addition to the manual adjustment to let the `linux-gcc` CI job run
the test suite with `master` and then with `main`, this patch makes sure
that GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME is set in all test scripts
that currently rely on the initial branch name being `master by default.
To determine which test scripts to mark up, the first step was to
force-set the default branch name to `master` in
- all test scripts that contain the keyword `master`,
- t4211, which expects `t/t4211/history.export` with a hard-coded ref to
initialize the default branch,
- t5560 because it sources `t/t556x_common` which uses `master`,
- t8002 and t8012 because both source `t/annotate-tests.sh` which also
uses `master`)
This trick was performed by this command:
$ sed -i '/^ *\. \.\/\(test-lib\|lib-\(bash\|cvs\|git-svn\)\|gitweb-lib\)\.sh$/i\
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master\
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\
' $(git grep -l master t/t[0-9]*.sh) \
t/t4211*.sh t/t5560*.sh t/t8002*.sh t/t8012*.sh
After that, careful, manual inspection revealed that some of the test
scripts containing the needle `master` do not actually rely on a
specific default branch name: either they mention `master` only in a
comment, or they initialize that branch specificially, or they do not
actually refer to the current default branch. Therefore, the
aforementioned modification was undone in those test scripts thusly:
$ git checkout HEAD -- \
t/t0027-auto-crlf.sh t/t0060-path-utils.sh \
t/t1011-read-tree-sparse-checkout.sh \
t/t1305-config-include.sh t/t1309-early-config.sh \
t/t1402-check-ref-format.sh t/t1450-fsck.sh \
t/t2024-checkout-dwim.sh \
t/t2106-update-index-assume-unchanged.sh \
t/t3040-subprojects-basic.sh t/t3301-notes.sh \
t/t3308-notes-merge.sh t/t3423-rebase-reword.sh \
t/t3436-rebase-more-options.sh \
t/t4015-diff-whitespace.sh t/t4257-am-interactive.sh \
t/t5323-pack-redundant.sh t/t5401-update-hooks.sh \
t/t5511-refspec.sh t/t5526-fetch-submodules.sh \
t/t5529-push-errors.sh t/t5530-upload-pack-error.sh \
t/t5548-push-porcelain.sh \
t/t5552-skipping-fetch-negotiator.sh \
t/t5572-pull-submodule.sh t/t5608-clone-2gb.sh \
t/t5614-clone-submodules-shallow.sh \
t/t7508-status.sh t/t7606-merge-custom.sh \
t/t9302-fast-import-unpack-limit.sh
We excluded one set of test scripts in these commands, though: the range
of `git p4` tests. The reason? `git p4` stores the (foreign) remote
branch in the branch called `p4/master`, which is obviously not the
default branch. Manual analysis revealed that only five of these tests
actually require a specific default branch name to pass; They were
modified thusly:
$ sed -i '/^ *\. \.\/lib-git-p4\.sh$/i\
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master\
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME\
' t/t980[0167]*.sh t/t9811*.sh
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-11-19 00:44:19 +01:00
|
|
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
|
|
|
|
2012-10-14 07:42:32 +02:00
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
#########
|
|
|
|
|
|
|
|
check_start_tree() {
|
2012-12-08 22:35:53 +01:00
|
|
|
rm -f "$WORKDIR/list.expected"
|
|
|
|
echo "start $1" >>"${WORKDIR}/check.log"
|
2012-10-14 07:42:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
check_file() {
|
2012-12-08 22:35:53 +01:00
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
check_end_tree() {
|
2012-12-08 22:35:53 +01:00
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
check_end_full_tree() {
|
2012-12-08 22:35:53 +01:00
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#########
|
|
|
|
|
|
|
|
check_diff() {
|
2012-12-08 22:35:53 +01:00
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#########
|
|
|
|
|
|
|
|
cvs >/dev/null 2>&1
|
|
|
|
if test $? -ne 1
|
|
|
|
then
|
2012-12-08 22:35:53 +01:00
|
|
|
skip_all='skipping git-cvsserver tests, cvs not found'
|
|
|
|
test_done
|
2012-10-14 07:42:32 +02:00
|
|
|
fi
|
|
|
|
if ! test_have_prereq PERL
|
|
|
|
then
|
2012-12-08 22:35:53 +01:00
|
|
|
skip_all='skipping git-cvsserver tests, perl not available'
|
|
|
|
test_done
|
2012-10-14 07:42:32 +02:00
|
|
|
fi
|
2013-10-29 02:23:03 +01:00
|
|
|
perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
|
2012-12-08 22:35:53 +01:00
|
|
|
skip_all='skipping git-cvsserver tests, Perl SQLite interface unavailable'
|
|
|
|
test_done
|
2012-10-14 07:42:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
unset GIT_DIR GIT_CONFIG
|
mingw: work around pwd issues in the tests
In Git for Windows' SDK, the tests are run using a Bash that relies on
the POSIX emulation layer MSYS2 (itself a friendly fork of Cygwin). As
such, paths in tests can be POSIX paths. As soon as those paths are
passed to git.exe (which does *not* use the POSIX emulation layer),
those paths are converted into Windows paths, though. This happens
for command-line parameters, but not when reading, say, config variables.
To help with that, the `pwd` command is overridden to return the Windows
path of the current working directory when testing Git on Windows.
However, when talking to anything using the POSIX emulation layer, it is
really much better to use POSIX paths because Windows paths contain a
colon after the drive letter that will easily be mistaken for the common
separator in path lists.
So let's just use the $PWD variable when the POSIX path is needed.
This lets t7800-difftool.sh, t9400-git-cvsserver-server.sh,
t9402-git-cvsserver-refs.sh and t9401-git-cvsserver-crlf.sh pass in Git
for Windows' SDK.
Note: the cvsserver tests require not only the `cvs` package (install
it into Git for Windows' SDK via `pacman -S cvs`) but also the Perl
SQLite bindings (install them into Git for Windows' SDK via
`cpan DBD::SQLite`).
This patch is based on earlier work by 마누엘 and Karsten Blees.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-27 17:19:59 +01:00
|
|
|
WORKDIR=$PWD
|
|
|
|
SERVERDIR=$PWD/gitcvs.git
|
2012-10-14 07:42:32 +02:00
|
|
|
git_config="$SERVERDIR/config"
|
|
|
|
CVSROOT=":fork:$SERVERDIR"
|
mingw: work around pwd issues in the tests
In Git for Windows' SDK, the tests are run using a Bash that relies on
the POSIX emulation layer MSYS2 (itself a friendly fork of Cygwin). As
such, paths in tests can be POSIX paths. As soon as those paths are
passed to git.exe (which does *not* use the POSIX emulation layer),
those paths are converted into Windows paths, though. This happens
for command-line parameters, but not when reading, say, config variables.
To help with that, the `pwd` command is overridden to return the Windows
path of the current working directory when testing Git on Windows.
However, when talking to anything using the POSIX emulation layer, it is
really much better to use POSIX paths because Windows paths contain a
colon after the drive letter that will easily be mistaken for the common
separator in path lists.
So let's just use the $PWD variable when the POSIX path is needed.
This lets t7800-difftool.sh, t9400-git-cvsserver-server.sh,
t9402-git-cvsserver-refs.sh and t9401-git-cvsserver-crlf.sh pass in Git
for Windows' SDK.
Note: the cvsserver tests require not only the `cvs` package (install
it into Git for Windows' SDK via `pacman -S cvs`) but also the Perl
SQLite bindings (install them into Git for Windows' SDK via
`cpan DBD::SQLite`).
This patch is based on earlier work by 마누엘 and Karsten Blees.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-27 17:19:59 +01:00
|
|
|
CVSWORK="$PWD/cvswork"
|
2012-10-14 07:42:32 +02:00
|
|
|
CVS_SERVER=git-cvsserver
|
|
|
|
export CVSROOT CVS_SERVER
|
|
|
|
|
|
|
|
rm -rf "$CVSWORK" "$SERVERDIR"
|
|
|
|
test_expect_success 'setup v1, b1' '
|
2012-12-08 22:35:53 +01:00
|
|
|
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"
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
rm -rf cvswork
|
|
|
|
test_expect_success 'cvs co v1' '
|
2020-11-19 00:44:42 +01:00
|
|
|
cvs -f -Q co -r v1 -d cvswork main >cvs.log 2>&1 &&
|
2012-12-08 22:35:53 +01:00
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
rm -rf cvswork
|
|
|
|
test_expect_success 'cvs co b1' '
|
2020-11-19 00:44:42 +01:00
|
|
|
cvs -f co -r b1 -d cvswork main >cvs.log 2>&1 &&
|
2012-12-08 22:35:53 +01:00
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'cvs co b1 [cvswork3]' '
|
2020-11-19 00:44:42 +01:00
|
|
|
cvs -f co -r b1 -d cvswork3 main >cvs.log 2>&1 &&
|
2012-12-08 22:35:53 +01:00
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'edit cvswork3 and save diff' '
|
2012-12-08 22:35:53 +01:00
|
|
|
(
|
|
|
|
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"
|
|
|
|
)
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'setup v1.2 on b1' '
|
2012-12-08 22:35:53 +01:00
|
|
|
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 &&
|
t: don't spuriously close and reopen quotes
In the test scripts, the recommended style is, e.g.:
test_expect_success 'name' '
do-something somehow &&
do-some-more testing
'
When using this style, any single quote in the multi-line test section
is actually closing the lone single quotes that surround it.
It can be a non-issue in practice:
test_expect_success 'sed a little' '
sed -e 's/hi/lo/' in >out # "ok": no whitespace in s/hi/lo/
'
Or it can be a bug in the test, e.g., because variable interpolation
happens before the test even begins executing:
v=abc
test_expect_success 'variable interpolation' '
v=def &&
echo '"$v"' # abc
'
Change several such in-test single quotes to use double quotes instead
or, in a few cases, drop them altogether. These were identified using
some crude grepping. We're not fixing any test bugs here, but we're
hopefully making these tests slightly easier to grok and to maintain.
There are legitimate use cases for closing a quote and opening a new
one, e.g., both '\'' and '"'"' can be used to produce a literal single
quote. I'm not touching any of those here.
In t9401, tuck the redirecting ">" to the filename while we're touching
those lines.
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-08-06 22:08:53 +02:00
|
|
|
git commit -q -m "v1.2" &&
|
2012-12-08 22:35:53 +01:00
|
|
|
git tag v1.2 &&
|
|
|
|
git push --tags gitcvs.git b1:b1
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'cvs -f up (on b1 adir)' '
|
2012-12-08 22:35:53 +01:00
|
|
|
( 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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'cvs up (on b1 /)' '
|
2012-12-08 22:35:53 +01:00
|
|
|
( 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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
# Make sure "CVS/Tag" files didn't get messed up:
|
|
|
|
test_expect_success 'cvs up (on b1 /) (again; check CVS/Tag files)' '
|
2012-12-08 22:35:53 +01:00
|
|
|
( 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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
# update to another version:
|
|
|
|
test_expect_success 'cvs up -r v1' '
|
2012-12-08 22:35:53 +01:00
|
|
|
( 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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'cvs up' '
|
2012-12-08 22:35:53 +01:00
|
|
|
( 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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'cvs up (again; check CVS/Tag files)' '
|
2012-12-08 22:35:53 +01:00
|
|
|
( 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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'setup simple b2' '
|
2012-12-08 22:35:53 +01:00
|
|
|
git branch b2 v1 &&
|
|
|
|
git push --tags gitcvs.git b2:b2
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'cvs co b2 [into cvswork2]' '
|
2020-11-19 00:44:42 +01:00
|
|
|
cvs -f co -r b2 -d cvswork2 main >cvs.log 2>&1 &&
|
2012-12-08 22:35:53 +01:00
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'root dir edit [cvswork2]' '
|
2012-12-08 22:35:53 +01:00
|
|
|
(
|
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'root dir rm file [cvswork2]' '
|
2012-12-08 22:35:53 +01:00
|
|
|
(
|
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
2012-12-08 22:34:55 +01:00
|
|
|
test_expect_success 'subdir edit/add/rm files [cvswork2]' '
|
2012-12-08 22:35:53 +01:00
|
|
|
(
|
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'validate result of edits [cvswork2]' '
|
2012-12-08 22:35:53 +01:00
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'validate basic diffs saved during above cvswork2 edits' '
|
2012-12-08 22:35:53 +01:00
|
|
|
test $(grep Index: cvsEdit1.diff | wc -l) = 1 &&
|
2013-06-09 20:29:20 +02:00
|
|
|
test_must_be_empty cvsEdit2-empty.diff &&
|
2012-12-08 22:35:53 +01:00
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'validate v1.2 diff saved during last cvswork2 edit' '
|
2012-12-08 22:35:53 +01:00
|
|
|
test $(grep Index: cvsEdit3-v1.2.diff | wc -l) = 9 &&
|
|
|
|
check_diff cvsEdit3-v1.2.diff v1.2 v2
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'validate v1.2 v1 diff saved during last cvswork2 edit' '
|
2012-12-08 22:35:53 +01:00
|
|
|
test $(grep Index: cvsEdit3-v1.2-v1.diff | wc -l) = 9 &&
|
|
|
|
check_diff cvsEdit3-v1.2-v1.diff v1.2 v1
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'cvs up [cvswork2]' '
|
2012-12-08 22:35:53 +01:00
|
|
|
( 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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'cvs up -r b2 [back to cvswork]' '
|
2012-12-08 22:35:53 +01:00
|
|
|
( 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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'cvs up -r b1' '
|
2012-12-08 22:35:53 +01:00
|
|
|
( 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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'cvs up -A' '
|
2012-12-08 22:35:53 +01:00
|
|
|
( 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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'cvs up (check CVS/Tag files)' '
|
2012-12-08 22:35:53 +01:00
|
|
|
( 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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
# This is not really legal CVS, but it seems to work anyway:
|
|
|
|
test_expect_success 'cvs up -r heads/b1' '
|
2012-12-08 22:35:53 +01:00
|
|
|
( 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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
# But this should work even if CVS client checks -r more carefully:
|
|
|
|
test_expect_success 'cvs up -r heads_-s-b2 (cvsserver escape mechanism)' '
|
2012-12-08 22:35:53 +01:00
|
|
|
( 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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
v1hash=$(git rev-parse v1)
|
|
|
|
test_expect_success 'cvs up -r $(git rev-parse v1)' '
|
2012-12-08 22:35:53 +01:00
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'cvs diff -r v1 -u' '
|
2018-03-08 13:38:44 +01:00
|
|
|
( cd cvswork && cvs -f diff -r v1 -u >../cvsDiff.out 2>../cvs.log ) &&
|
2013-06-09 20:29:20 +02:00
|
|
|
test_must_be_empty cvsDiff.out &&
|
|
|
|
test_must_be_empty cvs.log
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'cvs diff -N -r v2 -u' '
|
2018-03-08 13:38:44 +01:00
|
|
|
( cd cvswork && ! cvs -f diff -N -r v2 -u >../cvsDiff.out 2>../cvs.log ) &&
|
2013-06-09 20:29:20 +02:00
|
|
|
test_must_be_empty cvs.log &&
|
2012-12-08 22:35:53 +01:00
|
|
|
test -s cvsDiff.out &&
|
|
|
|
check_diff cvsDiff.out v2 v1 >check_diff.out 2>&1
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'cvs diff -N -r v2 -r v1.2' '
|
2018-03-08 13:38:44 +01:00
|
|
|
( cd cvswork && ! cvs -f diff -N -r v2 -r v1.2 -u >../cvsDiff.out 2>../cvs.log ) &&
|
2013-06-09 20:29:20 +02:00
|
|
|
test_must_be_empty cvs.log &&
|
2012-12-08 22:35:53 +01:00
|
|
|
test -s cvsDiff.out &&
|
|
|
|
check_diff cvsDiff.out v2 v1.2 >check_diff.out 2>&1
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'apply early [cvswork3] diff to b3' '
|
2012-12-08 22:35:53 +01:00
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'check [cvswork3] diff' '
|
2018-03-08 13:38:44 +01:00
|
|
|
( cd cvswork3 && ! cvs -f diff -N -u >"$WORKDIR/cvsDiff.out" 2>../cvs.log ) &&
|
2013-06-09 20:29:20 +02:00
|
|
|
test_must_be_empty cvs.log &&
|
2012-12-08 22:35:53 +01:00
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'merge early [cvswork3] b3 with b1' '
|
2015-03-26 05:58:45 +01:00
|
|
|
( cd gitwork3 && git merge -m "message" b1 ) &&
|
2012-12-08 22:35:53 +01:00
|
|
|
git fetch gitwork3 b3:b3 &&
|
|
|
|
git tag v3merged b3 &&
|
|
|
|
git push --tags gitcvs.git b3:b3
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
# 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]' '
|
2012-12-08 22:35:53 +01:00
|
|
|
(
|
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
# TODO: test cvs status
|
|
|
|
|
2012-12-08 22:34:55 +01:00
|
|
|
test_expect_success 'cvs commit [cvswork3]' '
|
2012-12-08 22:35:53 +01:00
|
|
|
(
|
|
|
|
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
|
2012-10-14 07:42:32 +02:00
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|