2007-05-02 00:45:22 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2007 Frank Lichtenheld
|
|
|
|
#
|
|
|
|
|
|
|
|
test_description='git-cvsserver access
|
|
|
|
|
|
|
|
tests read access to a git repository with the
|
|
|
|
cvs CLI client via git-cvsserver server'
|
|
|
|
|
2020-11-18 23:44:42 +00: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-18 23:44:19 +00:00
|
|
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
|
|
|
|
2007-05-02 00:45:22 +00:00
|
|
|
. ./test-lib.sh
|
|
|
|
|
2009-04-03 19:33:59 +00:00
|
|
|
if ! test_have_prereq PERL; then
|
2010-06-24 17:44:48 +00:00
|
|
|
skip_all='skipping git cvsserver tests, perl not available'
|
2009-04-03 19:33:59 +00:00
|
|
|
test_done
|
|
|
|
fi
|
2007-05-02 00:45:22 +00:00
|
|
|
cvs >/dev/null 2>&1
|
|
|
|
if test $? -ne 1
|
|
|
|
then
|
2010-06-24 17:44:48 +00:00
|
|
|
skip_all='skipping git-cvsserver tests, cvs not found'
|
2007-05-02 00:45:22 +00:00
|
|
|
test_done
|
|
|
|
fi
|
2013-10-29 01:23:03 +00:00
|
|
|
perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {
|
2010-06-24 17:44:48 +00:00
|
|
|
skip_all='skipping git-cvsserver tests, Perl SQLite interface unavailable'
|
2007-05-09 16:19:42 +00:00
|
|
|
test_done
|
|
|
|
}
|
2007-05-02 00:45:22 +00:00
|
|
|
|
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 16:19:59 +00:00
|
|
|
WORKDIR=$PWD
|
|
|
|
SERVERDIR=$PWD/gitcvs.git
|
2007-05-11 23:35:18 +00:00
|
|
|
git_config="$SERVERDIR/config"
|
2007-05-02 00:45:22 +00:00
|
|
|
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 16:19:59 +00:00
|
|
|
CVSWORK="$PWD/cvswork"
|
2007-05-02 00:45:22 +00:00
|
|
|
CVS_SERVER=git-cvsserver
|
|
|
|
export CVSROOT CVS_SERVER
|
|
|
|
|
2021-09-15 08:09:47 +00:00
|
|
|
if perl -e 'exit(1) if not defined crypt("", "cv")'
|
|
|
|
then
|
|
|
|
PWDHASH='lac2ItudM3.KM'
|
|
|
|
else
|
|
|
|
PWDHASH='$2b$10$t8fGvE/a9eLmfOLzsZme2uOa2QtoMYwIxq9wZA6aBKtF1Yb7FJIzi'
|
|
|
|
fi
|
2021-09-15 08:09:46 +00:00
|
|
|
|
2007-05-02 00:45:22 +00:00
|
|
|
rm -rf "$CVSWORK" "$SERVERDIR"
|
2008-01-26 09:54:05 +00:00
|
|
|
test_expect_success 'setup' '
|
2013-01-05 00:22:26 +00:00
|
|
|
git config push.default matching &&
|
2008-01-26 09:54:05 +00:00
|
|
|
echo >empty &&
|
2007-05-02 00:45:22 +00:00
|
|
|
git add empty &&
|
|
|
|
git commit -q -m "First Commit" &&
|
2008-01-26 09:54:06 +00:00
|
|
|
mkdir secondroot &&
|
|
|
|
( cd secondroot &&
|
|
|
|
git init &&
|
|
|
|
touch secondrootfile &&
|
|
|
|
git add secondrootfile &&
|
|
|
|
git commit -m "second root") &&
|
2020-11-18 23:44:42 +00:00
|
|
|
git fetch secondroot main &&
|
merge: refuse to create too cool a merge by default
While it makes sense to allow merging unrelated histories of two
projects that started independently into one, in the way "gitk" was
merged to "git" itself aka "the coolest merge ever", such a merge is
still an unusual event. Worse, if somebody creates an independent
history by starting from a tarball of an established project and
sends a pull request to the original project, "git merge" however
happily creates such a merge without any sign of something unusual
is happening.
Teach "git merge" to refuse to create such a merge by default,
unless the user passes a new "--allow-unrelated-histories" option to
tell it that the user is aware that two unrelated projects are
merged.
Because such a "two project merge" is a rare event, a configuration
option to always allow such a merge is not added.
We could add the same option to "git pull" and have it passed
through to underlying "git merge". I do not have a fundamental
opposition against such a feature, but this commit does not do so
and instead leaves it as low-hanging fruit for others, because such
a "two project merge" would be done after fetching the other project
into some location in the working tree of an existing project and
making sure how well they fit together, it is sufficient to allow a
local merge without such an option pass-through from "git pull" to
"git merge". Many tests that are updated by this patch does the
pass-through manually by turning:
git pull something
into its equivalent:
git fetch something &&
git merge --allow-unrelated-histories FETCH_HEAD
If somebody is inclined to add such an option, updated tests in this
change need to be adjusted back to:
git pull --allow-unrelated-histories something
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-18 20:21:09 +00:00
|
|
|
git merge --allow-unrelated-histories FETCH_HEAD &&
|
2009-03-06 23:04:09 +00:00
|
|
|
git clone -q --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 &&
|
2007-05-02 00:45:22 +00:00
|
|
|
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
|
2010-05-15 02:46:04 +00:00
|
|
|
GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log" &&
|
|
|
|
GIT_DIR="$SERVERDIR" git config gitcvs.authdb "$SERVERDIR/auth.db" &&
|
2021-09-15 08:09:46 +00:00
|
|
|
echo "cvsuser:$PWDHASH" >"$SERVERDIR/auth.db"
|
2008-01-26 09:54:05 +00:00
|
|
|
'
|
2007-05-02 00:45:22 +00:00
|
|
|
|
|
|
|
# note that cvs doesn't accept absolute pathnames
|
|
|
|
# as argument to co -d
|
|
|
|
test_expect_success 'basic checkout' \
|
2020-11-18 23:44:42 +00:00
|
|
|
'GIT_CONFIG="$git_config" cvs -Q co -d cvswork main &&
|
2010-10-31 01:46:54 +00:00
|
|
|
test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | head -n 1))" = "empty/1.1/" &&
|
2008-03-12 21:34:34 +00:00
|
|
|
test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | sed -ne \$p))" = "secondrootfile/1.1/"'
|
2007-05-02 00:45:22 +00:00
|
|
|
|
2007-05-20 22:31:58 +00:00
|
|
|
#------------------------
|
|
|
|
# PSERVER AUTHENTICATION
|
|
|
|
#------------------------
|
|
|
|
|
|
|
|
cat >request-anonymous <<EOF
|
|
|
|
BEGIN AUTH REQUEST
|
|
|
|
$SERVERDIR
|
|
|
|
anonymous
|
|
|
|
|
|
|
|
END AUTH REQUEST
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat >request-git <<EOF
|
|
|
|
BEGIN AUTH REQUEST
|
|
|
|
$SERVERDIR
|
|
|
|
git
|
|
|
|
|
|
|
|
END AUTH REQUEST
|
|
|
|
EOF
|
|
|
|
|
2007-05-27 12:33:10 +00:00
|
|
|
cat >login-anonymous <<EOF
|
|
|
|
BEGIN VERIFICATION REQUEST
|
|
|
|
$SERVERDIR
|
|
|
|
anonymous
|
|
|
|
|
|
|
|
END VERIFICATION REQUEST
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat >login-git <<EOF
|
|
|
|
BEGIN VERIFICATION REQUEST
|
|
|
|
$SERVERDIR
|
|
|
|
git
|
|
|
|
|
|
|
|
END VERIFICATION REQUEST
|
|
|
|
EOF
|
|
|
|
|
2010-05-15 02:46:04 +00:00
|
|
|
cat >login-git-ok <<EOF
|
|
|
|
BEGIN VERIFICATION REQUEST
|
|
|
|
$SERVERDIR
|
|
|
|
cvsuser
|
|
|
|
Ah<Z:yZZ30 e
|
|
|
|
END VERIFICATION REQUEST
|
|
|
|
EOF
|
|
|
|
|
2007-05-20 22:31:58 +00:00
|
|
|
test_expect_success 'pserver authentication' \
|
|
|
|
'cat request-anonymous | git-cvsserver pserver >log 2>&1 &&
|
2010-01-26 23:08:31 +00:00
|
|
|
sed -ne \$p log | grep "^I LOVE YOU\$"'
|
2007-05-20 22:31:58 +00:00
|
|
|
|
|
|
|
test_expect_success 'pserver authentication failure (non-anonymous user)' \
|
|
|
|
'if cat request-git | git-cvsserver pserver >log 2>&1
|
|
|
|
then
|
|
|
|
false
|
|
|
|
else
|
|
|
|
true
|
|
|
|
fi &&
|
2010-01-26 23:08:31 +00:00
|
|
|
sed -ne \$p log | grep "^I HATE YOU\$"'
|
2007-05-20 22:31:58 +00:00
|
|
|
|
2010-05-15 02:46:04 +00:00
|
|
|
test_expect_success 'pserver authentication success (non-anonymous user with password)' \
|
|
|
|
'cat login-git-ok | git-cvsserver pserver >log 2>&1 &&
|
|
|
|
sed -ne \$p log | grep "^I LOVE YOU\$"'
|
|
|
|
|
2007-05-27 12:33:10 +00:00
|
|
|
test_expect_success 'pserver authentication (login)' \
|
|
|
|
'cat login-anonymous | git-cvsserver pserver >log 2>&1 &&
|
2010-01-26 23:08:31 +00:00
|
|
|
sed -ne \$p log | grep "^I LOVE YOU\$"'
|
2007-05-27 12:33:10 +00:00
|
|
|
|
|
|
|
test_expect_success 'pserver authentication failure (login/non-anonymous user)' \
|
|
|
|
'if cat login-git | git-cvsserver pserver >log 2>&1
|
|
|
|
then
|
|
|
|
false
|
|
|
|
else
|
|
|
|
true
|
|
|
|
fi &&
|
2010-01-26 23:08:31 +00:00
|
|
|
sed -ne \$p log | grep "^I HATE YOU\$"'
|
2007-05-27 12:33:10 +00:00
|
|
|
|
2007-05-20 22:31:58 +00:00
|
|
|
|
2007-06-07 14:57:00 +00:00
|
|
|
# misuse pserver authentication for testing of req_Root
|
|
|
|
|
|
|
|
cat >request-relative <<EOF
|
|
|
|
BEGIN AUTH REQUEST
|
|
|
|
gitcvs.git
|
|
|
|
anonymous
|
|
|
|
|
|
|
|
END AUTH REQUEST
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat >request-conflict <<EOF
|
|
|
|
BEGIN AUTH REQUEST
|
|
|
|
$SERVERDIR
|
|
|
|
anonymous
|
|
|
|
|
|
|
|
END AUTH REQUEST
|
|
|
|
Root $WORKDIR
|
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'req_Root failure (relative pathname)' \
|
|
|
|
'if cat request-relative | git-cvsserver pserver >log 2>&1
|
|
|
|
then
|
|
|
|
echo unexpected success
|
|
|
|
false
|
|
|
|
else
|
|
|
|
true
|
|
|
|
fi &&
|
2008-03-12 21:32:17 +00:00
|
|
|
tail log | grep "^error 1 Root must be an absolute pathname$"'
|
2007-06-07 14:57:00 +00:00
|
|
|
|
|
|
|
test_expect_success 'req_Root failure (conflicting roots)' \
|
|
|
|
'cat request-conflict | git-cvsserver pserver >log 2>&1 &&
|
2008-03-12 21:32:17 +00:00
|
|
|
tail log | grep "^error 1 Conflicting roots specified$"'
|
2007-06-07 14:57:00 +00:00
|
|
|
|
2007-06-07 14:57:01 +00:00
|
|
|
test_expect_success 'req_Root (strict paths)' \
|
2008-05-04 05:37:59 +00:00
|
|
|
'cat request-anonymous | git-cvsserver --strict-paths pserver "$SERVERDIR" >log 2>&1 &&
|
2010-01-26 23:08:31 +00:00
|
|
|
sed -ne \$p log | grep "^I LOVE YOU\$"'
|
2007-06-07 14:57:01 +00:00
|
|
|
|
2008-02-01 09:50:53 +00:00
|
|
|
test_expect_success 'req_Root failure (strict-paths)' '
|
|
|
|
! cat request-anonymous |
|
2008-05-04 05:37:59 +00:00
|
|
|
git-cvsserver --strict-paths pserver "$WORKDIR" >log 2>&1
|
2008-02-01 09:50:53 +00:00
|
|
|
'
|
2007-06-07 14:57:01 +00:00
|
|
|
|
|
|
|
test_expect_success 'req_Root (w/o strict-paths)' \
|
2008-05-04 05:37:59 +00:00
|
|
|
'cat request-anonymous | git-cvsserver pserver "$WORKDIR/" >log 2>&1 &&
|
2010-01-26 23:08:31 +00:00
|
|
|
sed -ne \$p log | grep "^I LOVE YOU\$"'
|
2007-06-07 14:57:01 +00:00
|
|
|
|
2008-02-01 09:50:53 +00:00
|
|
|
test_expect_success 'req_Root failure (w/o strict-paths)' '
|
|
|
|
! cat request-anonymous |
|
2008-05-04 05:37:59 +00:00
|
|
|
git-cvsserver pserver "$WORKDIR/gitcvs" >log 2>&1
|
2008-02-01 09:50:53 +00:00
|
|
|
'
|
2007-06-07 14:57:01 +00:00
|
|
|
|
|
|
|
cat >request-base <<EOF
|
|
|
|
BEGIN AUTH REQUEST
|
|
|
|
/gitcvs.git
|
|
|
|
anonymous
|
|
|
|
|
|
|
|
END AUTH REQUEST
|
2007-06-15 01:01:52 +00:00
|
|
|
Root /gitcvs.git
|
2007-06-07 14:57:01 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
test_expect_success 'req_Root (base-path)' \
|
2008-05-04 05:37:59 +00:00
|
|
|
'cat request-base | git-cvsserver --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 &&
|
2010-01-26 23:08:31 +00:00
|
|
|
sed -ne \$p log | grep "^I LOVE YOU\$"'
|
2007-06-07 14:57:01 +00:00
|
|
|
|
2008-02-01 09:50:53 +00:00
|
|
|
test_expect_success 'req_Root failure (base-path)' '
|
|
|
|
! cat request-anonymous |
|
2008-05-04 05:37:59 +00:00
|
|
|
git-cvsserver --strict-paths --base-path "$WORKDIR" pserver "$SERVERDIR" >log 2>&1
|
2008-02-01 09:50:53 +00:00
|
|
|
'
|
2007-06-07 14:57:00 +00:00
|
|
|
|
2007-06-15 01:01:53 +00:00
|
|
|
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false || exit 1
|
|
|
|
|
|
|
|
test_expect_success 'req_Root (export-all)' \
|
2008-05-04 05:37:59 +00:00
|
|
|
'cat request-anonymous | git-cvsserver --export-all pserver "$WORKDIR" >log 2>&1 &&
|
2010-01-26 23:08:31 +00:00
|
|
|
sed -ne \$p log | grep "^I LOVE YOU\$"'
|
2007-06-15 01:01:53 +00:00
|
|
|
|
2008-02-01 09:50:53 +00:00
|
|
|
test_expect_success 'req_Root failure (export-all w/o whitelist)' \
|
|
|
|
'! (cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || false)'
|
2007-06-15 01:01:53 +00:00
|
|
|
|
|
|
|
test_expect_success 'req_Root (everything together)' \
|
2008-05-04 05:37:59 +00:00
|
|
|
'cat request-base | git-cvsserver --export-all --strict-paths --base-path "$WORKDIR/" pserver "$SERVERDIR" >log 2>&1 &&
|
2010-01-26 23:08:31 +00:00
|
|
|
sed -ne \$p log | grep "^I LOVE YOU\$"'
|
2007-06-15 01:01:53 +00:00
|
|
|
|
|
|
|
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true || exit 1
|
|
|
|
|
2007-05-20 22:31:56 +00:00
|
|
|
#--------------
|
|
|
|
# CONFIG TESTS
|
|
|
|
#--------------
|
|
|
|
|
|
|
|
test_expect_success 'gitcvs.enabled = false' \
|
|
|
|
'GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false &&
|
2020-11-18 23:44:42 +00:00
|
|
|
if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1
|
2007-05-20 22:31:56 +00:00
|
|
|
then
|
|
|
|
echo unexpected cvs success
|
|
|
|
false
|
|
|
|
else
|
|
|
|
true
|
|
|
|
fi &&
|
2008-03-12 21:32:17 +00:00
|
|
|
grep "GITCVS emulation disabled" cvs.log &&
|
2007-05-20 22:31:56 +00:00
|
|
|
test ! -d cvswork2'
|
|
|
|
|
|
|
|
rm -fr cvswork2
|
|
|
|
test_expect_success 'gitcvs.ext.enabled = true' \
|
|
|
|
'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
|
|
|
|
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false &&
|
2020-11-18 23:44:42 +00:00
|
|
|
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
|
2010-03-12 05:40:33 +00:00
|
|
|
test_cmp cvswork cvswork2'
|
2007-05-20 22:31:56 +00:00
|
|
|
|
|
|
|
rm -fr cvswork2
|
|
|
|
test_expect_success 'gitcvs.ext.enabled = false' \
|
|
|
|
'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled false &&
|
|
|
|
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
|
2020-11-18 23:44:42 +00:00
|
|
|
if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1
|
2007-05-20 22:31:56 +00:00
|
|
|
then
|
|
|
|
echo unexpected cvs success
|
|
|
|
false
|
|
|
|
else
|
|
|
|
true
|
|
|
|
fi &&
|
2008-03-12 21:32:17 +00:00
|
|
|
grep "GITCVS emulation disabled" cvs.log &&
|
2007-05-20 22:31:56 +00:00
|
|
|
test ! -d cvswork2'
|
|
|
|
|
|
|
|
rm -fr cvswork2
|
|
|
|
test_expect_success 'gitcvs.dbname' \
|
|
|
|
'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
|
|
|
|
GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs.%a.%m.sqlite &&
|
2020-11-18 23:44:42 +00:00
|
|
|
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
|
2010-03-12 05:40:33 +00:00
|
|
|
test_cmp cvswork cvswork2 &&
|
2020-11-18 23:44:42 +00:00
|
|
|
test -f "$SERVERDIR/gitcvs.ext.main.sqlite" &&
|
|
|
|
cmp "$SERVERDIR/gitcvs.main.sqlite" "$SERVERDIR/gitcvs.ext.main.sqlite"'
|
2007-05-20 22:31:56 +00:00
|
|
|
|
|
|
|
rm -fr cvswork2
|
|
|
|
test_expect_success 'gitcvs.ext.dbname' \
|
|
|
|
'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true &&
|
|
|
|
GIT_DIR="$SERVERDIR" git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&
|
|
|
|
GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&
|
2020-11-18 23:44:42 +00:00
|
|
|
GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 main >cvs.log 2>&1 &&
|
2010-03-12 05:40:33 +00:00
|
|
|
test_cmp cvswork cvswork2 &&
|
2020-11-18 23:44:42 +00:00
|
|
|
test -f "$SERVERDIR/gitcvs1.ext.main.sqlite" &&
|
|
|
|
test ! -f "$SERVERDIR/gitcvs2.ext.main.sqlite" &&
|
|
|
|
cmp "$SERVERDIR/gitcvs.main.sqlite" "$SERVERDIR/gitcvs1.ext.main.sqlite"'
|
2007-05-20 22:31:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
#------------
|
|
|
|
# CVS UPDATE
|
|
|
|
#------------
|
|
|
|
|
|
|
|
rm -fr "$SERVERDIR"
|
|
|
|
cd "$WORKDIR" &&
|
2009-03-06 23:04:09 +00:00
|
|
|
git clone -q --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 &&
|
2007-05-20 22:31:56 +00:00
|
|
|
GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true &&
|
2007-06-25 14:00:24 +00:00
|
|
|
GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log" ||
|
2007-05-20 22:31:56 +00:00
|
|
|
exit 1
|
|
|
|
|
2007-05-02 00:45:22 +00:00
|
|
|
test_expect_success 'cvs update (create new file)' \
|
|
|
|
'echo testfile1 >testfile1 &&
|
|
|
|
git add testfile1 &&
|
|
|
|
git commit -q -m "Add testfile1" &&
|
|
|
|
git push gitcvs.git >/dev/null &&
|
|
|
|
cd cvswork &&
|
2007-05-11 23:35:18 +00:00
|
|
|
GIT_CONFIG="$git_config" cvs -Q update &&
|
2007-05-02 00:45:22 +00:00
|
|
|
test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.1/" &&
|
2010-03-12 05:40:33 +00:00
|
|
|
test_cmp testfile1 ../testfile1'
|
2007-05-02 00:45:22 +00:00
|
|
|
|
|
|
|
cd "$WORKDIR"
|
|
|
|
test_expect_success 'cvs update (update existing file)' \
|
|
|
|
'echo line 2 >>testfile1 &&
|
|
|
|
git add testfile1 &&
|
|
|
|
git commit -q -m "Append to testfile1" &&
|
|
|
|
git push gitcvs.git >/dev/null &&
|
|
|
|
cd cvswork &&
|
2007-05-11 23:35:18 +00:00
|
|
|
GIT_CONFIG="$git_config" cvs -Q update &&
|
2007-05-02 00:45:22 +00:00
|
|
|
test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.2/" &&
|
2010-03-12 05:40:33 +00:00
|
|
|
test_cmp testfile1 ../testfile1'
|
2007-05-02 00:45:22 +00:00
|
|
|
|
|
|
|
cd "$WORKDIR"
|
|
|
|
#TODO: cvsserver doesn't support update w/o -d
|
2008-02-01 09:50:53 +00:00
|
|
|
test_expect_failure "cvs update w/o -d doesn't create subdir (TODO)" '
|
|
|
|
mkdir test &&
|
2007-05-02 00:45:22 +00:00
|
|
|
echo >test/empty &&
|
|
|
|
git add test &&
|
|
|
|
git commit -q -m "Single Subdirectory" &&
|
|
|
|
git push gitcvs.git >/dev/null &&
|
|
|
|
cd cvswork &&
|
2007-05-11 23:35:18 +00:00
|
|
|
GIT_CONFIG="$git_config" cvs -Q update &&
|
2008-02-01 09:50:53 +00:00
|
|
|
test ! -d test
|
|
|
|
'
|
2007-05-02 00:45:22 +00:00
|
|
|
|
|
|
|
cd "$WORKDIR"
|
|
|
|
test_expect_success 'cvs update (subdirectories)' \
|
|
|
|
'(for dir in A A/B A/B/C A/D E; do
|
|
|
|
mkdir $dir &&
|
|
|
|
echo "test file in $dir" >"$dir/file_in_$(echo $dir|sed -e "s#/# #g")" &&
|
2021-12-09 05:11:15 +00:00
|
|
|
git add $dir || exit 1
|
2007-05-02 00:45:22 +00:00
|
|
|
done) &&
|
|
|
|
git commit -q -m "deep sub directory structure" &&
|
|
|
|
git push gitcvs.git >/dev/null &&
|
|
|
|
cd cvswork &&
|
2007-05-11 23:35:18 +00:00
|
|
|
GIT_CONFIG="$git_config" cvs -Q update -d &&
|
2007-05-02 00:45:22 +00:00
|
|
|
(for dir in A A/B A/B/C A/D E; do
|
|
|
|
filename="file_in_$(echo $dir|sed -e "s#/# #g")" &&
|
|
|
|
if test "$(echo $(grep -v ^D $dir/CVS/Entries|cut -d/ -f2,3,5))" = "$filename/1.1/" &&
|
2010-03-12 05:40:33 +00:00
|
|
|
test_cmp "$dir/$filename" "../$dir/$filename"; then
|
2007-05-02 00:45:22 +00:00
|
|
|
:
|
|
|
|
else
|
2021-12-09 05:11:10 +00:00
|
|
|
exit 1
|
2007-05-02 00:45:22 +00:00
|
|
|
fi
|
2021-12-09 05:11:10 +00:00
|
|
|
done)'
|
2007-05-02 00:45:22 +00:00
|
|
|
|
|
|
|
cd "$WORKDIR"
|
|
|
|
test_expect_success 'cvs update (delete file)' \
|
|
|
|
'git rm testfile1 &&
|
|
|
|
git commit -q -m "Remove testfile1" &&
|
|
|
|
git push gitcvs.git >/dev/null &&
|
|
|
|
cd cvswork &&
|
2007-05-11 23:35:18 +00:00
|
|
|
GIT_CONFIG="$git_config" cvs -Q update &&
|
2007-05-02 00:45:22 +00:00
|
|
|
test -z "$(grep testfile1 CVS/Entries)" &&
|
|
|
|
test ! -f testfile1'
|
|
|
|
|
|
|
|
cd "$WORKDIR"
|
|
|
|
test_expect_success 'cvs update (re-add deleted file)' \
|
|
|
|
'echo readded testfile >testfile1 &&
|
|
|
|
git add testfile1 &&
|
|
|
|
git commit -q -m "Re-Add testfile1" &&
|
|
|
|
git push gitcvs.git >/dev/null &&
|
|
|
|
cd cvswork &&
|
2007-05-11 23:35:18 +00:00
|
|
|
GIT_CONFIG="$git_config" cvs -Q update &&
|
2007-05-02 00:45:22 +00:00
|
|
|
test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.4/" &&
|
2010-03-12 05:40:33 +00:00
|
|
|
test_cmp testfile1 ../testfile1'
|
2007-05-02 00:45:22 +00:00
|
|
|
|
2007-05-20 22:31:57 +00:00
|
|
|
cd "$WORKDIR"
|
|
|
|
test_expect_success 'cvs update (merge)' \
|
|
|
|
'echo Line 0 >expected &&
|
|
|
|
for i in 1 2 3 4 5 6 7
|
|
|
|
do
|
2018-07-02 00:24:04 +00:00
|
|
|
echo Line $i >>merge &&
|
2021-12-09 05:11:15 +00:00
|
|
|
echo Line $i >>expected || return 1
|
2007-05-20 22:31:57 +00:00
|
|
|
done &&
|
|
|
|
echo Line 8 >>expected &&
|
|
|
|
git add merge &&
|
|
|
|
git commit -q -m "Merge test (pre-merge)" &&
|
|
|
|
git push gitcvs.git >/dev/null &&
|
|
|
|
cd cvswork &&
|
|
|
|
GIT_CONFIG="$git_config" cvs -Q update &&
|
|
|
|
test "$(echo $(grep merge CVS/Entries|cut -d/ -f2,3,5))" = "merge/1.1/" &&
|
2010-03-12 05:40:33 +00:00
|
|
|
test_cmp merge ../merge &&
|
2018-07-02 00:24:04 +00:00
|
|
|
( echo Line 0 && cat merge ) >merge.tmp &&
|
2007-05-20 22:31:57 +00:00
|
|
|
mv merge.tmp merge &&
|
|
|
|
cd "$WORKDIR" &&
|
|
|
|
echo Line 8 >>merge &&
|
|
|
|
git add merge &&
|
|
|
|
git commit -q -m "Merge test (merge)" &&
|
|
|
|
git push gitcvs.git >/dev/null &&
|
|
|
|
cd cvswork &&
|
2007-05-27 12:33:09 +00:00
|
|
|
sleep 1 && touch merge &&
|
2007-05-20 22:31:57 +00:00
|
|
|
GIT_CONFIG="$git_config" cvs -Q update &&
|
2010-03-12 05:40:33 +00:00
|
|
|
test_cmp merge ../expected'
|
2007-05-20 22:31:57 +00:00
|
|
|
|
|
|
|
cd "$WORKDIR"
|
|
|
|
|
|
|
|
cat >expected.C <<EOF
|
|
|
|
<<<<<<< merge.mine
|
|
|
|
Line 0
|
|
|
|
=======
|
|
|
|
LINE 0
|
2012-10-14 05:42:21 +00:00
|
|
|
>>>>>>> merge.1.3
|
2007-05-20 22:31:57 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
for i in 1 2 3 4 5 6 7 8
|
|
|
|
do
|
|
|
|
echo Line $i >>expected.C
|
|
|
|
done
|
|
|
|
|
|
|
|
test_expect_success 'cvs update (conflict merge)' \
|
2018-07-02 00:24:04 +00:00
|
|
|
'( echo LINE 0 && cat merge ) >merge.tmp &&
|
2007-05-20 22:31:57 +00:00
|
|
|
mv merge.tmp merge &&
|
|
|
|
git add merge &&
|
|
|
|
git commit -q -m "Merge test (conflict)" &&
|
|
|
|
git push gitcvs.git >/dev/null &&
|
|
|
|
cd cvswork &&
|
|
|
|
GIT_CONFIG="$git_config" cvs -Q update &&
|
2010-03-12 05:40:33 +00:00
|
|
|
test_cmp merge ../expected.C'
|
2007-05-20 22:31:57 +00:00
|
|
|
|
|
|
|
cd "$WORKDIR"
|
|
|
|
test_expect_success 'cvs update (-C)' \
|
|
|
|
'cd cvswork &&
|
|
|
|
GIT_CONFIG="$git_config" cvs -Q update -C &&
|
2010-03-12 05:40:33 +00:00
|
|
|
test_cmp merge ../merge'
|
2007-05-20 22:31:57 +00:00
|
|
|
|
|
|
|
cd "$WORKDIR"
|
|
|
|
test_expect_success 'cvs update (merge no-op)' \
|
|
|
|
'echo Line 9 >>merge &&
|
|
|
|
cp merge cvswork/merge &&
|
|
|
|
git add merge &&
|
|
|
|
git commit -q -m "Merge test (no-op)" &&
|
|
|
|
git push gitcvs.git >/dev/null &&
|
|
|
|
cd cvswork &&
|
2007-05-27 12:33:09 +00:00
|
|
|
sleep 1 && touch merge &&
|
2007-05-20 22:31:57 +00:00
|
|
|
GIT_CONFIG="$git_config" cvs -Q update &&
|
2010-03-12 05:40:33 +00:00
|
|
|
test_cmp merge ../merge'
|
2007-05-20 22:31:57 +00:00
|
|
|
|
2008-03-27 22:18:23 +00:00
|
|
|
cd "$WORKDIR"
|
|
|
|
test_expect_success 'cvs update (-p)' '
|
|
|
|
touch really-empty &&
|
|
|
|
echo Line 1 > no-lf &&
|
2008-10-31 05:09:13 +00:00
|
|
|
printf "Line 2" >> no-lf &&
|
2008-03-27 22:18:23 +00:00
|
|
|
git add really-empty no-lf &&
|
|
|
|
git commit -q -m "Update -p test" &&
|
|
|
|
git push gitcvs.git >/dev/null &&
|
|
|
|
cd cvswork &&
|
|
|
|
GIT_CONFIG="$git_config" cvs update &&
|
|
|
|
for i in merge no-lf empty really-empty; do
|
t9400-git-cvsserver-server: don't rely on the output of 'test_cmp'
The test 'cvs update (-p)' redirects and checks 'test_cmp's stdout and
even its stderr. The commit introducing this test in 6e8937a084
(cvsserver: Add test for update -p, 2008-03-27) doesn't discuss why,
in fact its log message only consists of that subject line. Anyway,
weird as it is, it kind of made sense due to the way that test was
structured:
After a bit of preparation, this test updates four files via CVS and
checks their contents using 'test_cmp', but it does so in a for loop
iterating over the names of those four files. Now, the exit status of
a for loop is the exit status of the last command executed in the
loop, meaning that the test can't simply rely on the exit code of
'test_cmp' in the loop's body. Instead, the test works it around by
relying on the stdout of 'test_cmp' being silent on success and
showing the diff on failure, as it appends the stdout of all four
'test_cmp' invocations to a single file and checks that file's
emptiness after the loop (with 'test -z "$(cat ...)"', no less; there
was no 'test_must_be_empty' back then). Furthermore, the test
redirects the stderr of those 'test_cmp' invocations to this file,
too: while 'test_cmp' itself doesn't output anything to stderr, the
invoked 'diff' or 'cmp' commands do send their error messages there,
e.g. if they can't open a file because its name was misspelled.
This also makes this test fail when the test script is run with '-x'
tracing (and using a shell other than a Bash version supporting
BASH_XTRACEFD), because 'test_cmp's stderr contains the trace of the
'diff' command executed inside the helper function, throwing off the
subsequent emptiness check.
Stop relying on 'test_cmp's output and instead run 'test_cmp a b ||
return 1' in the for loop in order to make 'test_cmp's error code fail
the test. Furthermore, add the missing && after the cvs command to
create a && chain in the loop's body.
After this change t9400 passes with '-x', even when running with
/bin/sh.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-08 22:44:58 +00:00
|
|
|
GIT_CONFIG="$git_config" cvs update -p "$i" >$i.out &&
|
|
|
|
test_cmp $i.out ../$i || return 1
|
|
|
|
done
|
2008-03-27 22:18:23 +00:00
|
|
|
'
|
|
|
|
|
2008-07-17 17:00:28 +00:00
|
|
|
cd "$WORKDIR"
|
|
|
|
test_expect_success 'cvs update (module list supports packed refs)' '
|
|
|
|
GIT_DIR="$SERVERDIR" git pack-refs --all &&
|
|
|
|
GIT_CONFIG="$git_config" cvs -n up -d 2> out &&
|
2020-11-18 23:44:42 +00:00
|
|
|
grep "cvs update: New directory \`main'\''" < out
|
2008-07-17 17:00:28 +00:00
|
|
|
'
|
|
|
|
|
2008-03-27 22:18:02 +00:00
|
|
|
#------------
|
|
|
|
# CVS STATUS
|
|
|
|
#------------
|
|
|
|
|
|
|
|
cd "$WORKDIR"
|
|
|
|
test_expect_success 'cvs status' '
|
|
|
|
mkdir status.dir &&
|
|
|
|
echo Line > status.dir/status.file &&
|
|
|
|
echo Line > status.file &&
|
|
|
|
git add status.dir status.file &&
|
|
|
|
git commit -q -m "Status test" &&
|
|
|
|
git push gitcvs.git >/dev/null &&
|
|
|
|
cd cvswork &&
|
|
|
|
GIT_CONFIG="$git_config" cvs update &&
|
|
|
|
GIT_CONFIG="$git_config" cvs status | grep "^File: status.file" >../out &&
|
2012-04-11 11:24:01 +00:00
|
|
|
test_line_count = 2 ../out
|
2008-03-27 22:18:02 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
cd "$WORKDIR"
|
|
|
|
test_expect_success 'cvs status (nonrecursive)' '
|
|
|
|
cd cvswork &&
|
|
|
|
GIT_CONFIG="$git_config" cvs status -l | grep "^File: status.file" >../out &&
|
2012-04-11 11:24:01 +00:00
|
|
|
test_line_count = 1 ../out
|
2008-03-27 22:18:02 +00:00
|
|
|
'
|
|
|
|
|
|
|
|
cd "$WORKDIR"
|
|
|
|
test_expect_success 'cvs status (no subdirs in header)' '
|
|
|
|
cd cvswork &&
|
|
|
|
GIT_CONFIG="$git_config" cvs status | grep ^File: >../out &&
|
|
|
|
! grep / <../out
|
|
|
|
'
|
|
|
|
|
2008-07-17 17:00:30 +00:00
|
|
|
#------------
|
|
|
|
# CVS CHECKOUT
|
|
|
|
#------------
|
|
|
|
|
|
|
|
cd "$WORKDIR"
|
|
|
|
test_expect_success 'cvs co -c (shows module database)' '
|
|
|
|
GIT_CONFIG="$git_config" cvs co -c > out &&
|
2020-11-18 23:44:42 +00:00
|
|
|
grep "^main[ ][ ]*main$" <out &&
|
|
|
|
! grep -v "^main[ ][ ]*main$" <out
|
2008-07-17 17:00:30 +00:00
|
|
|
'
|
|
|
|
|
2012-10-14 05:42:14 +00:00
|
|
|
#------------
|
|
|
|
# CVS LOG
|
|
|
|
#------------
|
|
|
|
|
|
|
|
# Known issues with git-cvsserver current log output:
|
|
|
|
# - Hard coded "lines: +2 -3" placeholder, instead of real numbers.
|
|
|
|
# - CVS normally does not internally add a blank first line
|
2014-03-31 22:11:47 +00:00
|
|
|
# or a last line with nothing but a space to log messages.
|
2012-10-14 05:42:14 +00:00
|
|
|
# - The latest cvs 1.12.x server sends +0000 timezone (with some hidden "MT"
|
|
|
|
# tagging in the protocol), and if cvs 1.12.x client sees the MT tags,
|
|
|
|
# it converts to local time zone. git-cvsserver doesn't do the +0000
|
|
|
|
# or the MT tags...
|
|
|
|
# - The latest 1.12.x releases add a "commitid:" field on to the end of the
|
|
|
|
# "date:" line (after "lines:"). Maybe we could stick git's commit id
|
|
|
|
# in it? Or does CVS expect a certain number of bits (too few for
|
|
|
|
# a full sha1)?
|
|
|
|
#
|
|
|
|
# Given the above, expect the following test to break if git-cvsserver's
|
|
|
|
# log output is improved. The test is just to ensure it doesn't
|
|
|
|
# accidentally get worse.
|
|
|
|
|
|
|
|
sed -e 's/^x//' -e 's/SP$/ /' > "$WORKDIR/expect" <<EOF
|
|
|
|
x
|
2020-11-18 23:44:42 +00:00
|
|
|
xRCS file: $WORKDIR/gitcvs.git/main/merge,v
|
2012-10-14 05:42:14 +00:00
|
|
|
xWorking file: merge
|
|
|
|
xhead: 1.4
|
|
|
|
xbranch:
|
|
|
|
xlocks: strict
|
|
|
|
xaccess list:
|
|
|
|
xsymbolic names:
|
|
|
|
xkeyword substitution: kv
|
|
|
|
xtotal revisions: 4; selected revisions: 4
|
|
|
|
xdescription:
|
|
|
|
x----------------------------
|
|
|
|
xrevision 1.4
|
|
|
|
xdate: __DATE__; author: author; state: Exp; lines: +2 -3
|
|
|
|
x
|
|
|
|
xMerge test (no-op)
|
|
|
|
xSP
|
|
|
|
x----------------------------
|
|
|
|
xrevision 1.3
|
|
|
|
xdate: __DATE__; author: author; state: Exp; lines: +2 -3
|
|
|
|
x
|
|
|
|
xMerge test (conflict)
|
|
|
|
xSP
|
|
|
|
x----------------------------
|
|
|
|
xrevision 1.2
|
|
|
|
xdate: __DATE__; author: author; state: Exp; lines: +2 -3
|
|
|
|
x
|
|
|
|
xMerge test (merge)
|
|
|
|
xSP
|
|
|
|
x----------------------------
|
|
|
|
xrevision 1.1
|
|
|
|
xdate: __DATE__; author: author; state: Exp; lines: +2 -3
|
|
|
|
x
|
|
|
|
xMerge test (pre-merge)
|
|
|
|
xSP
|
|
|
|
x=============================================================================
|
|
|
|
EOF
|
|
|
|
expectStat="$?"
|
|
|
|
|
|
|
|
cd "$WORKDIR"
|
|
|
|
test_expect_success 'cvs log' '
|
|
|
|
cd cvswork &&
|
|
|
|
test x"$expectStat" = x"0" &&
|
|
|
|
GIT_CONFIG="$git_config" cvs log merge >../out &&
|
|
|
|
sed -e "s%2[0-9][0-9][0-9]/[01][0-9]/[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9]%__DATE__%" ../out > ../actual &&
|
|
|
|
test_cmp ../expect ../actual
|
|
|
|
'
|
|
|
|
|
2008-09-05 07:57:35 +00:00
|
|
|
#------------
|
|
|
|
# CVS ANNOTATE
|
|
|
|
#------------
|
|
|
|
|
|
|
|
cd "$WORKDIR"
|
|
|
|
test_expect_success 'cvs annotate' '
|
|
|
|
cd cvswork &&
|
|
|
|
GIT_CONFIG="$git_config" cvs annotate merge >../out &&
|
|
|
|
sed -e "s/ .*//" ../out >../actual &&
|
2021-12-09 05:11:11 +00:00
|
|
|
printf "1.%d\n" 3 1 1 1 1 1 1 1 2 4 >../expect &&
|
2008-09-05 07:57:35 +00:00
|
|
|
test_cmp ../expect ../actual
|
|
|
|
'
|
|
|
|
|
2017-09-11 15:27:51 +00:00
|
|
|
#------------
|
|
|
|
# running via git-shell
|
|
|
|
#------------
|
|
|
|
|
|
|
|
cd "$WORKDIR"
|
|
|
|
|
|
|
|
test_expect_success 'create remote-cvs helper' '
|
|
|
|
write_script remote-cvs <<-\EOF
|
|
|
|
exec git shell -c "cvs server"
|
|
|
|
EOF
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'cvs server does not run with vanilla git-shell' '
|
|
|
|
(
|
|
|
|
cd cvswork &&
|
|
|
|
CVS_SERVER=$WORKDIR/remote-cvs &&
|
|
|
|
export CVS_SERVER &&
|
2020-07-07 22:08:07 +00:00
|
|
|
! cvs log merge
|
2017-09-11 15:27:51 +00:00
|
|
|
)
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'configure git shell to run cvs server' '
|
|
|
|
mkdir "$HOME"/git-shell-commands &&
|
|
|
|
|
|
|
|
write_script "$HOME"/git-shell-commands/cvs <<-\EOF &&
|
|
|
|
if ! test $# = 1 && test "$1" = "server"
|
|
|
|
then
|
|
|
|
echo >&2 "git-cvsserver only handles \"server\""
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
exec git cvsserver server
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Should not be used, but part of the recommended setup
|
|
|
|
write_script "$HOME"/git-shell-commands/no-interactive-login <<-\EOF
|
|
|
|
echo Interactive login forbidden
|
|
|
|
EOF
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'cvs server can run with recommended config' '
|
|
|
|
(
|
|
|
|
cd cvswork &&
|
|
|
|
CVS_SERVER=$WORKDIR/remote-cvs &&
|
|
|
|
export CVS_SERVER &&
|
|
|
|
cvs log merge
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
2007-05-02 00:45:22 +00:00
|
|
|
test_done
|