aboutsummaryrefslogtreecommitdiffstats
path: root/git-cvsserver.perl
AgeCommit message (Collapse)AuthorFilesLines
2023-11-17perl: bump the required Perl version to 5.8.1 from 5.8.0Todd Zullinger1-1/+1
The following commit will make use of a Getopt::Long feature which is only present in Perl >= 5.8.1. Document that as the minimum version we support. Many of our Perl scripts will continue to run with 5.8.0 but this change allows us to adjust them as needed without breaking any promises to our users. The Perl requirement was last changed in d48b284183 (perl: bump the required Perl version to 5.8 from 5.6.[21], 2010-09-24). At that time, 5.8.0 was 8 years old. It is now over 21 years old. Signed-off-by: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-19git-cvsserver: clarify directory listDerrick Stolee1-1/+1
The documentation and error messages for git-cvsserver include some references to a "whitelist" that is not otherwise included in the documentation. When different parts of the documentation do not use common language, this can lead to confusion as to how things are meant to operate. Further, the word "whitelist" has cultural implications that make its use non-inclusive. Thankfully, we can remove it while increasing clarity. Update Documentation/git-cvsserver.txt in a similar way to the previous change to Documentation/git-daemon.txt. The optional '<directory>...' list can specify a list of allowed directories. We refer to that list directly inside of the documentation for the GIT_CVSSERVER_ROOT environment variable. While modifying this documentation, update the environment variables to use a list format. We use the modern way of tabbing the description of each variable in this section. We do _not_ update the description of '<directory>...' to use tabs this way since the rest of the items in the OPTIONS list do not use this modern formatting. A single error message in the actual git-cvsserver.perl code refers to the whitelist during argument parsing. Instead, refer to the directory list that has been clarified in the documentation. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-10-29tests: disable fsync everywhereEric Wong1-0/+19
The "GIT_TEST_FSYNC" environment variable now exists for disabling fsync() even on packfiles and other "critical" data. Running "make test -j8 NO_SVN_TESTS=1" on a noisy 8-core system on an HDD, test runtime drops from ~4 minutes down to ~3 minutes. Using "GIT_TEST_FSYNC=1" re-enables fsync() for comparison purposes. SVN interopability tests are minimally affected since SVN will still use fsync in various places. This will also be useful for 3rd-party tools which create throwaway git repositories of temporary data, but remains undocumented for end users. Signed-off-by: Eric Wong <e@80x24.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-16git-cvsserver: protect against NULL in crypt(3)Carlo Marcelo Arenas Belón1-2/+3
Some versions of crypt(3) will return NULL when passed an unsupported hash type (ex: OpenBSD with DES), so check for undef instead of using it directly. Also use this to probe the system and select a better hash function in the tests, so it can pass successfully. Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> [jc: <CAPUEspjqD5zy8TLuFA96usU7FYi=0wF84y7NgOVFqegtxL9zbw@mail.gmail.com>] Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-09-16git-cvsserver: use crypt correctly to compare password hashesCarlo Marcelo Arenas Belón1-1/+1
c057bad370 (git-cvsserver: use a password file cvsserver pserver, 2010-05-15) adds a way for `git cvsserver` to provide authenticated pserver accounts without having clear text passwords, but uses the username instead of the password to the call for crypt(3). Correct that, and make sure the documentation correctly indicates how to obtain hashed passwords that could be used to populate this configuration, as well as correcting the hash that was used for the tests. This change will require that any user of this feature updates the hashes in their configuration, but has the advantage of using a more similar format than cvs uses, probably also easying any migration. Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-06-14*: fix typos which duplicate a wordAndrei Rybak1-1/+1
Fix typos in documentation, code comments, and RelNotes which repeat various words. In trivial cases, just delete the duplicated word and rewrap text, if needed. Reword the affected sentence in Documentation/RelNotes/1.8.4.txt for it to make sense. Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-22git-cvsserver: port to SHA-256brian m. carlson1-17/+20
The code of git-cvsserver currently has several hard-coded 20 and 40 constants that are the length of SHA-1. When parsing the configuration file, read the extensions.objectformat configuration setting as well as CVS-related ones and adjust the hash sizes accordingly. Use these computed values in all the places we match object IDs. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Acked-by: Eric Wong <e@80x24.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-09-11cvsserver: use safe_pipe_capture for `constant commands` as wellJunio C Hamano1-4/+4
This is not strictly necessary, but it is a good code hygiene. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-09-11cvsserver: use safe_pipe_capture instead of backticksjoernchen1-11/+11
This makes the script pass arguments that are derived from end-user input in safer way when invoking subcommands. Reported-by: joernchen <joernchen@phenoelit.de> Signed-off-by: joernchen <joernchen@phenoelit.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-09-11cvsserver: move safe_pipe_capture() to the main packageJunio C Hamano1-25/+22
As a preparation for replacing `command` with a call to this function from outside GITCVS::updater package, move it to the main package. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-05-06typofix: assorted typofixes in comments, documentation and messagesLi Peng1-3/+3
Many instances of duplicate words (e.g. "the the path") and a few typoes are fixed, originally in multiple patches. wildmatch: fix duplicate words of "the" t: fix duplicate words of "output" transport-helper: fix duplicate words of "read" Git.pm: fix duplicate words of "return" path: fix duplicate words of "look" pack-protocol.txt: fix duplicate words of "the" precompose-utf8: fix typo of "sequences" split-index: fix typo worktree.c: fix typo remote-ext: fix typo utf8: fix duplicate words of "the" git-cvsserver: fix duplicate words Signed-off-by: Li Peng <lip@dtdream.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-02-17git-cvsserver.perl: fix typoGyuYong Jung1-1/+1
Signed-off-by: GyuYong Jung <obliviscence@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-11-04Merge branch 'ak/cvsserver-stabilize-use-of-hash-keys'Junio C Hamano1-5/+5
* ak/cvsserver-stabilize-use-of-hash-keys: cvsserver: Determinize output to combat Perl 5.18 hash randomization
2013-10-30cvsserver: Determinize output to combat Perl 5.18 hash randomizationAnders Kaseorg1-5/+5
Perl 5.18 randomizes the seed used by its hash function, so iterating through hashes results in different orders from run to run: http://perldoc.perl.org/perl5180delta.html#Hash-overhaul This usually broke t9400 (gitcvs.dbname, gitcvs.ext.dbname, when running cmp on two .sqlite files) and t9402 (check [cvswork3] diff, when running test_cmp on two diffs). To fix this, hide the internal order of hashes with sort when sending output or running database queries. (An alternative workaround is PERL_HASH_SEED=0, but this seems nicer.) Signed-off-by: Anders Kaseorg <andersk@mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-09-18Merge branch 'jc/cvsserver-perm-bit-fix'Junio C Hamano1-1/+1
"git cvsserver" computed the permission mode bits incorrectly for executable files. * jc/cvsserver-perm-bit-fix: cvsserver: pick up the right mode bits
2013-09-11cvsserver: pick up the right mode bitsJunio C Hamano1-1/+1
When determining the file mode from either ls-tree or diff-tree output, we used to grab these octal mode string (typically 100644 or 100755) and then did $git_perms .= "r" if ( $mode & 4 ); $git_perms .= "w" if ( $mode & 2 ); $git_perms .= "x" if ( $mode & 1 ); which was already wrong, as (100644 & 4) is very different from oct("100644") & 4. An earlier refactoring 2c3af7e7 (cvsserver: factor out git-log parsing logic, 2012-10-13) further changed it to pick the third octal digit (10*0*644 or 10*0*755) from the left and then do the above conversion, which does not make sense, either. Let's use the third digit from the last of the octal mode string to make sure we get the executable and read bits right. Signed-off-by: Junio C Hamano <gitster@pobox.com> Tested-by: Michael Cronenworth <mike@cchtml.com>
2013-09-04use 'tree-ish' instead of 'treeish'Richard Hansen1-1/+1
Replace 'treeish' in documentation and comments with 'tree-ish' to match gitglossary(7). The only remaining instances of 'treeish' are: * variable, function, and macro names * "(also treeish)" in the definition of tree-ish in gitglossary(7) Signed-off-by: Richard Hansen <rhansen@bbn.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12Correct common spelling mistakes in comments and testsStefano Lattarini1-2/+2
Most of these were found using Lucas De Marchi's codespell tool. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-24git-cvsimport: use a lowercase "usage:" stringDavid Aguilar1-1/+1
Make the usage string consistent with Git. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver: support -r and sticky tags for most operationsMatthew Ogilvie1-203/+510
- Split off prepDirForOutput for "update" and "commit". Some low level protocol details were changed to more closely resemble CVS even in non-tagged cases. Hopefully it still works with finicky clients like Eclipse. - Substantial changes to "diff". The output is now closer to standard CVS (including exit status), and can be used as a patch, but there are still a number of differences compared to CVS. - Tweaks to "add", "remove", "status", and "commit". - FUTURE: CVS revision numbers for branches simply encode git commit IDs in a way that resembles CVS revision numbers, dropping all normal CVS structural relations between different revision numbers. - FUTURE: "log" doesn't try to work properly at all with branches and tags. - FUTURE: "annotate" probably doesn't work with branches or tags either (untested)? Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver: Add version awareness to argsfromdirMatthew Ogilvie1-30/+198
Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver: generalize getmeta() to recognize commit refsMatthew Ogilvie1-11/+145
This allows getmeta() to recognize any commitish (sha1, tag/branch name, etc). Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver: implement req_Sticky and related utilitiesMatthew Ogilvie1-2/+169
Nothing sets sticky yet, or uses the values set by this, but soon... Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver: add misc commit lookup, file meta data, and file listing functionsMatthew Ogilvie1-1/+365
These will be used soon, but not yet. PERFORMANCE NOTE: getMetaFromCommithash() does not scale well as currently implemented. See comment for possible optimization strategies. Fortunately, it will only be used in cases that would not have worked at all before this change. Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver: define a tag name character escape mechanismMatthew Ogilvie1-0/+91
CVS tags are officially only allowed to use [-_0-9A-Za-f]. Git refs commonly uses other characters, especially [./]. Such characters need to be escaped from CVS in order to be referenced. This just defines functions to escape/unescape names. The functions are not used yet. Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver: cleanup extra slashes in filename argumentsMatthew Ogilvie1-0/+28
Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver: factor out git-log parsing logicMatthew Ogilvie1-71/+105
Some field conversion was already duplicated, and more calls will be added soon. Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver status: provide real sticky infoMatthew Ogilvie1-4/+20
Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver: cvs add: do not expand directory argumentsMatthew Ogilvie1-2/+0
Standard "cvs add" never does any recursion. With standard cvs, "cvs add dir" will either add just the "dir" to the repository, or error out. Prior to this change, git-cvsserver would try to recurse (perhaps re-adding sandbox-removed files?) into the existing directory instead. Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver: use whole CVS rev number in-process; don't strip "1." prefixMatthew Ogilvie1-103/+122
Keep track of the whole CVS revision number in-process. This will clarify code when we start handling non-linear revision numbers later. There is one externally visible change: conflict markers after an update will now include the full CVS revision number, including the "1." prefix. It used to leave off the prefix. Other than the conflict marker, this change doesn't effect external functionality. No new features, and the DB schema is unchanged such that it continues to store just the stripped rev numbers (without prefix). Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver: split up long lines in req_{status,diff,log}Matthew Ogilvie1-61/+159
Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver: clean up client request handler map commentsMatthew Ogilvie1-1/+4
- Comment that it should not be considered a complete list. - #'annotate' comment - Uncommented annotate line is 2 lines earlier. Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver: remove unused functions _headrev and gethistoryMatthew Ogilvie1-32/+4
Remove: - _headrev() - It uses similar functionality from getmeta() and gethead(). - gethistory() - It uses similar functions gethistorydense() and getlog(). Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver update: comment about how we shouldn't remove a user-modified fileMatthew Ogilvie1-0/+4
Instead of a comment, we should really add test cases and actually fix it. Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver: add comments about database schema/usageMatthew Ogilvie1-4/+42
No functionality changes, but these comments should make it easier to understand how it works. Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-16cvsserver: removed unused sha1Or-k mode from kopts_from_pathMatthew Ogilvie1-33/+5
sha1Or-k was a vestige from an early, never-released attempt to handle some oddball cases of CRLF conversion (-k option). Ultimately it wasn't needed, and I should have gotten rid of it before submitting the CRLF patch in the first place. See also 90948a42892779 (add ability to guess -kb from contents). Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-10-05use -h for synopsis and --help for manpage consistentlyClemens Buchacher1-2/+2
A few scripted Porcelain implementations pretend as if the routine to show their own help messages are triggered upon "git cmd --help", but a command line parser of "git" will hijack such a request and shows the manpage for the cmd subcommand. Leaving the code to handle such input is simply misleading. Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-26Merge branch 'ab/require-perl-5.8'Junio C Hamano1-0/+1
* ab/require-perl-5.8: perl: use "use warnings" instead of -w perl: bump the required Perl version to 5.8 from 5.6.[21]
2010-10-06Martin Langhoff has a new e-mail addressJunio C Hamano1-3/+3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-27perl: bump the required Perl version to 5.8 from 5.6.[21]Ævar Arnfjörð Bjarmason1-0/+1
Formalize our dependency on perl 5.8, bumped from 5.6.[12]. We already used the three-arg form of open() which was introduced in 5.6.1, but t/t9700/test.pl explicitly depended on 5.6.2. However git-add--interactive.pl has been failing on the 5.6 line since it was introduced in v1.5.0-rc0~12^2~2 back in 2006 due to this open syntax: sub run_cmd_pipe { my $fh = undef; open($fh, '-|', @_) or die; return <$fh>; } Which when executed dies on "Can't use an undefined value as filehandle reference". Several of our tests also fail on 5.6 (even more when compiled with NO_PERL_MAKEMAKER=1): t2016-checkout-patch.sh t3904-stash-patch.sh t3701-add-interactive.sh t7105-reset-patch.sh t7501-commit.sh t9700-perl-git.sh Our code is bitrotting on 5.6 with no-one interested in fixing it, and pinning us to such an ancient release of Perl is keeping us from using useful features introduced in the 5.8 release. The 5.6 series is now over 10 years old, and the 5.6.2 maintenance release almost 7. 5.8 on the other hand is more than 8 years old. All the modern Unix-like operating systems have now upgraded to it or a later version, and 5.8 packages are available for old IRIX, AIX Solaris and Tru64 systems. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Acked-by: Tor Arntsen <tor@spacetec.no> Acked-by: Randal L. Schwartz <merlyn@stonehenge.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-21Merge branch 'eb/core-eol'Junio C Hamano1-4/+9
* eb/core-eol: Add "core.eol" config variable Rename the "crlf" attribute "text" Add per-repository eol normalization Add tests for per-repository eol normalization Conflicts: Documentation/config.txt Makefile
2010-06-20git-cvsserver: fix error for invalid password formatsÆvar Arnfjörð Bjarmason1-1/+4
Change the error message to report the erroneous password character. $1 was never set in the previos version, it was a leftover from older code that used a regex for the test. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-06-20git-cvsserver: typo in a comment: bas -> hasÆvar Arnfjörð Bjarmason1-1/+1
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-19git-cvsserver: Improved error handling for pserverÆvar Arnfjörð Bjarmason1-5/+24
- Produce an error if the user tries to supply a password for anonymous - Clarify the error message produced when there's no [gitcvs.authdb] - Produce an E error if the authdb doesn't exist instead of spewing $! to the user - do crypt($user, descramble($pass)) eq $hash; crypt($user, $hash) eq $hash would accept any password Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-19git-cvsserver: indent & clean up authdb codeÆvar Arnfjörð Bjarmason1-10/+13
- Indent the last commit to fit with the rest of the code. - Use lexical filehandles instead of global globs - Close the filehandle after the password database has been read. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-19git-cvsserver: use a password file cvsserver pserverSam Vilain1-14/+15
If a git repository is shared via HTTP, the config file is typically visible. Use an external file instead. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-19git-cvsserver: authentication support for pserverÆvar Arnfjörð Bjarmason1-8/+65
Allow git-cvsserver to use authentication over pserver mode. The pserver user/password database is stored in the config file for each repository. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Worriedly-Acked-by: Martin Langhoff <martin.langhoff@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-19Rename the "crlf" attribute "text"Eyvind Bernhardsen1-4/+9
As discussed on the list, "crlf" is not an optimal name. Linus suggested "text", which is much better. Signed-off-by: Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-28Merge branch 'gp/maint-cvsserver'Junio C Hamano1-1/+1
* gp/maint-cvsserver: git-cvsserver: allow regex metacharacters in CVSROOT
2010-01-26git-cvsserver: allow regex metacharacters in CVSROOTGerrit Pape1-1/+1
When run in a repository with a path name containing regex metacharacters (e.g. +), git-cvsserver failed to split the client request into CVSROOT and module. Now metacharacters are disabled for the value of CVSROOT in the perl regex so that directory names containing metacharacters are handled properly. Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-10Merge branch 'pm/cvs-environ'Junio C Hamano1-1/+21
* pm/cvs-environ: CVS Server: Support reading base and roots from environment
2009-12-31cvsserver: make the output of 'update' more compatible with cvs.Sergei Organov1-0/+16
Native cvs update outputs the string "cvs update: Updating <DIR>" for every directory it processes (to stderr) unless -q or -Q is given on comman-line. This is used, e.g., by emacs pcl-cvs to split files by directory. This commit implements this feature in cvsserver. Signed-off-by: Sergei Organov <osv@javad.com> Acked-by: Martin Langhoff <martin.langhoff@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-30CVS Server: Support reading base and roots from environmentPhil Miller1-1/+21
The Gitosis single-account Git/ssh hosting system runs git commands through git-shell after confirming that the connecting user is authorized to access the requested repository. This works well for upload-pack and receive-pack, which take a repository argument through git-shell. This doesn't work so well for `cvs server', which is passed through literally, with no arguments. Allowing arguments risks sneaking in `--export-all', so that restriction should be maintained. Despite that, passing a repository root is necessary for per-user access control by the hosting software, and passing a base path improves usability without weakening security. Thus, git-cvsserver needs to come up with these values at runtime by some other means. Since git-shell preserves the environment for other purposes, the environment can carry these arguments as well. Thus, modify git-cvsserver to read $GIT_CVSSERVER_{BASE_PATH,ROOT} in the absence of equivalent command line arguments. Signed-off-by: Phil Miller <mille121@illinois.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-09-02git-cvsserver: no longer use deprecated 'git-subcommand' commandsGerrit Pape1-20/+20
git-cvsserver still references git commands like 'git-config', which is depcrecated. This commit changes git-cvsserver to use the 'git subcommand' form. Sylvain Beucler reported the problem through http://bugs.debian.org/536067 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-30git-cvsserver: run post-update hook *after* update.Stefan Karpinski1-2/+2
CVS server was running the hook before the update action was actually done. This performs the update before the hook is called. The original commit that introduced the current incorrect behavior was 394d66d "git-cvsserver runs hooks/post-update". The error in ordering of the hook call appears to have gone unnoticed, but since git-cvsserver is supposed to emulate receive-pack, it stands to reason that the hook should be run *after* the update. Since this behavior is inconsistent with recieve-pack, users are either: 1) not using post-update hooks with git-cvsserver; 2) using post-update hooks that don't care whether they are called before or after the actual update occurs; 3) using post-update hooks *only* with git-cvsserver, and relying on the hook being called just before the update. This patch would affect only users in case 3. These users are depending on fairly obviously wrong behavior, and moreover they can simply change their current post-update into post-recieve hooks, and their systems will work correctly again. Signed-off-by: Stefan Karpinski <stefan.karpinski@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-30git-cvsserver: handle CVS 'noop' command.Stefan Karpinski1-0/+1
The CVS protocol documentation, found at http://www.wandisco.com/techpubs/cvs-protocol.pdf states the following about the 'noop' command: Response expected: yes. This request is a null command in the sense that it doesn't do anything, but merely (as with any other requests expecting a response) sends back any responses pertaining to pending errors, pending Notified responses, etc. In accordance with this, the correct way to handle the 'noop' command, when issued by a client, is to call req_EMPTY. The 'noop' command is called by some CVS clients, notably TortoiseCVS, thus making it desirable for git-cvsserver to respond to the command rather than choking on it as unknown. Signed-off-by: Stefan Karpinski <stefan.karpinski@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-05cvsserver: change generation of CVS author namesFabian Emmes1-3/+9
CVS username is generated from local part email address. We take the whole local part but restrict the character set to the Portable Filename Character Set, which is used for Unix login names according to Single Unix Specification v3. This will obviously report different usernames from existing repositories for commits with the local part of the author e-mail address that contains characters outside the PFCS. Hopefully this won't break an old CVS checkout from an earlier version of git-cvsserver, because the names are always shown afresh to the CVS clients and not kept on the client side. Signed-off-by: Fabian Emmes <fabian.emmes@rwth-aachen.de> Signed-off-by: Lars Noschinski <lars@public.noschinski.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-01-03cvsserver: add option to configure commit messageFabian Emmes1-1/+7
cvsserver annotates each commit message by "via git-CVS emulator". This is made configurable via gitcvs.commitmsgannotation. Signed-off-by: Fabian Emmes <fabian.emmes@rwth-aachen.de> Signed-off-by: Lars Noschinski <lars@public.noschinski.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-19cvsserver: Add cvs co -c supportLars Noschinski1-0/+12
Implement cvs checkout's -c option by returning a list of all "modules". This is more useful than displaying a perl warning if -c is given. Signed-off-by: Lars Noschinski <lars@public.noschinski.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-19cvsserver: Add support for packed refsLars Noschinski1-14/+8
req_update still parses /refs/heads manually. Replace this by a call to show-ref. Signed-off-by: Lars Noschinski <lars@public.noschinski.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-16Merge branch 'sb/dashless'Junio C Hamano1-1/+1
* sb/dashless: Make usage strings dash-less t/: Use "test_must_fail git" instead of "! git" t/test-lib.sh: exit with small negagive int is ok with test_must_fail Conflicts: builtin-blame.c builtin-mailinfo.c builtin-mailsplit.c builtin-shortlog.c git-am.sh t/t4150-am.sh t/t4200-rerere.sh
2008-07-16git-cvsserver: fix call to nonexistant cleanupWorkDir()Lars Noschinski1-1/+1
git-cvsserver.perl contained a single call to a nonexistant function cleanupWorkDir(). This was obviously a typo for cleanupWorkTree(). Signed-off-by: Lars Noschinski <lars@public.noschinski.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-13Make usage strings dash-lessStephan Beyer1-1/+1
When you misuse a git command, you are shown the usage string. But this is currently shown in the dashed form. So if you just copy what you see, it will not work, when the dashed form is no longer supported. This patch makes git commands show the dash-less version. For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh generates a dash-less usage string now. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-16git-cvsserver: add ability to guess -kb from contentsMatthew Ogilvie1-16/+177
If "gitcvs.allbinary" is set to "guess", then any file that has not been explicitly marked as binary or text using the "crlf" attribute and the "gitcvs.usecrlfattr" config will guess binary based on the contents of the file. Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-16implement gitcvs.usecrlfattrMatthew Ogilvie1-11/+60
If gitcvs.usecrlfattr is set to true, git-cvsserver will consult the "crlf" for each file to determine if it should mark the file as binary (-kb). Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-16git-cvsserver: add mechanism for managing working tree and current directoryMatthew Ogilvie1-39/+213
There are various reasons git-cvsserver needs to manipulate the current directory, and this patch attempts to clarify and validate such changes: 1. Temporary empty working directory (with index) for certain operations that require an index file to work. 2. Use a temporary directory with temporary file names for doing merges of user's dirty sandbox state with latest changes in repository. 3. Coming up soon: Set up an index and either a valid or empty working directory when calling git-check-attr to decide if a file should be marked binary (-kb). Signed-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-02Merge branch 'pb/cvsserver'Junio C Hamano1-1/+1
* pb/cvsserver: git-cvsserver: handle change type T
2008-04-02Merge branch 'dd/cvsserver'Junio C Hamano1-19/+59
* dd/cvsserver: cvsserver: Use the user part of the email in log and annotate results cvsserver: Add test for update -p cvsserver: Implement update -p (print to stdout) cvsserver: Add a few tests for 'status' command cvsserver: Do not include status output for subdirectories if -l is passed cvsserver: Only print the file part of the filename in status header cvsserver: Respond to the 'editors' and 'watchers' commands
2008-03-30Allow git-cvsserver database table name prefix to be specified.Josh Elsasser1-30/+93
Adds a gitcvs.dbtablenameprefix config variable, the contents of which are prepended to any database tables names used by git-cvsserver. The same substutions as gitcvs.dbname and gitcvs.dbuser are supported, and any non-alphabetic characters are replaced with underscores. A typo found in contrib/completion/git-completion.bash is also fixed. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-27git-cvsserver: handle change type TPaolo Bonzini1-1/+1
git-cvsserver does not support changes of type T (file type change, e.g. symlink->real file). This patch treats them the same as changes of type M. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-27cvsserver: Use the user part of the email in log and annotate resultsDamien Diederen1-4/+12
Generate the CVS author names by taking the first eight characters of the user part of the email address. The resulting names are more likely to make sense (or at least reduce ambiguities) in "corporate" environments. Signed-off-by: Damien Diederen <dash@foobox.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-27cvsserver: Implement update -p (print to stdout)Damien Diederen1-12/+35
Cvs update -p -r <rev> <path> is the documented way to retrieve a specific revision of a file (similar to git show <rev>:<path>). Without this patch, the -p flag is ignored and status output is produced, causing clients to interpret it as the contents of the file. TkCVS uses update -p as a basis for implementing its various "View" and "Diff" commands. Signed-off-by: Damien Diederen <dash@foobox.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-27cvsserver: Do not include status output for subdirectories if -l is passedDamien Diederen1-0/+2
This effectively implements the -l switch by pruning the entries whose filenames contain a path separator. It was previously ignored. Without this, TkCVS includes strange "ghost" entries in its directory listings. Signed-off-by: Damien Diederen <dash@foobox.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-27cvsserver: Only print the file part of the filename in status headerDamien Diederen1-1/+3
The "File:" header of CVS status output only includes the basename of the file, even when generating a recursive listing; do the same. Signed-off-by: Damien Diederen <dash@foobox.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-27cvsserver: Respond to the 'editors' and 'watchers' commandsDamien Diederen1-2/+7
These commands list users editing and watching locked files. This trivial implementation always returns an empty response, since git-cvsserver does not implement file locking. Without this, TkCVS hangs at startup, waiting forever for a response. Signed-off-by: Damien Diederen <dash@foobox.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-05specify explicit "--pretty=medium" with `git log/show/whatchanged`Denis Cheng1-1/+1
The following patch will introduce a new configuration variable, "format.pretty", from then on the pretty format without specifying "--pretty" might not be the default "--pretty=medium", it depends on the user's config. So all kinds of Shell/Perl/Emacs scripts that needs the default medium pretty format must specify it explicitly. Signed-off-by: Denis Cheng <crquan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-26cvsserver: Fix for histories with multiple rootsSteffen Prohaska1-1/+8
Git histories may have multiple roots, which can cause git merge-base to fail and this caused git cvsserver to die. This commit teaches git cvsserver to handle a failing git merge-base gracefully, and modifies the test case to verify this. All the test cases now use a history with two roots. Signed-off-by: Steffen Prohaska <prohaska@zib.de> git-cvsserver.perl | 9 ++++++++- t/t9400-git-cvsserver-server.sh | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05git-cvsserver runs hooks/post-updateJunio C Hamano1-0/+6
Although we have introduced post-receive, we have not deprecated post-update hook. This adds support for it to emulate receive-pack better. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-05git-cvsserver runs hooks/post-receiveMichael Witten1-7/+20
git-cvsserver just did the following: (1) run hooks/update (2) commit if hooks/update passed This commit simply adds: (3) run hooks/post-receive Also, there are a few grammar cleanups and consistency improvements. Signed-off-by: Michael Witten <mfwitten@mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-18cvsserver: Use exit 1 instead of die when req_Root fails.Brian Gernhardt1-2/+4
This was causing test failures because die was exiting 255. Signed-off-by: Brian Gernhardt <benji@silverinsanity.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-08-08cvsserver: Fix for work treesBrian Downing1-0/+2
git-cvsserver used checkout-index internally for commit and annotate. Since a work tree is required for this to function now, this was breaking. Work around this by defining GIT_WORK_TREE=. in the appropriate places. Signed-off-by: Brian Downing <bdowning@lavos.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-14git-cvsserver: detect/diagnose write failure, etc.Jim Meyering1-17/+33
There were many operations that did not notice and report errors to the CVS client, which would have resulted in corrupt working tree. Signed-off-by: Jim Meyering <jim@meyering.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-06cvsserver: always initialize state in argsplit()Frank Lichtenheld1-4/+4
Other code assumes that this is initialized, so do it even if there were no arguments given. Signed-off-by: Dirk Koopman <djk@tobit.co.uk> Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-15cvsserver: Actually implement --export-allFrank Lichtenheld1-1/+7
Embarrassing bug number two in my options patch. Also enforce that --export-all is only ever used together with an explicit whitelist. Otherwise people might export every git repository on the whole system without realising. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-15cvsserver: Let --base-path and pserver get along just fineFrank Lichtenheld1-4/+6
Embarassing bug number one in my options patch. Since the code for --base-path support rewrote the cvsroot value after comparing it with a possible existing value (i.e. from pserver authentication) the check always failed. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-08cvsserver: Add some useful commandline optionsFrank Lichtenheld1-6/+73
Make git-cvsserver understand some options inspired by git-daemon, namely --base-path, --export-all, --strict-paths. Also allow the caller to specify a whitelist of allowed directories, again similar to git-daemon. While already adding option parsing also support the common --help and --version options. Rationale: While the gitcvs.enabled configuration option already offers means to limit git-cvsserver access to a repository, there are some use cases where other methods of access control prove to be more useful. E.g. if setting up a pserver for a collection of public repositories one might want limit the exported repositories to exactly the directory this collection is located whithout having to worry about other repositories that might lie around with the configuration variable set (never trust your users ;) Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-08cvsserver: Make req_Root more critical of its input dataFrank Lichtenheld1-0/+11
The path submitted with the Root request has to be absolute (cvs does it this way and it may save us some sanity checks later) If multiple roots are specified (e.g. because we use pserver authentication which will already include the root), ensure that they say all the same. Probably neither is a security risk, and neither should ever be triggered by a sane client, but when validating input data, it's better to be save than sorry. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-05-29cvsserver: Handle 'cvs login'Frank Lichtenheld1-3/+5
Since this is a trivial variation of the general pserver authentication, there is really no reason not to support it. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-21git-cvsserver: fix disabling service via per-method configJunio C Hamano1-5/+3
When the per-method enable logic disables the access, we should not even look at the global one. git-cvsserver.perl | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-20git-cvsserver: exit with 1 upon "I HATE YOU"Junio C Hamano1-1/+1
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-13cvsserver: Don't send mixed messages to clientsFrank Lichtenheld1-0/+1
After we send I HATE YOU we should probably exit and not happily continue with I LOVE YOU and further communication. Most clients will probably just exit and ignore everything we send after the I HATE YOU and it is not a security problem either because we don't really care about the user name anyway. But it is still the right thing to do. [jc: with a minor fixup to its exit code...] Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Acked-by: "Martin Langhoff" <martin.langhoff@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-13cvsserver: Limit config parser to needed optionsFrank Lichtenheld1-3/+3
Change the configuration parser so that it ignores everything except for ^gitcvs.((ext|pserver).)? This greatly reduces the risk of failing while parsing some unknown and irrelevant config option. The bug that triggered this change was that the parsing doesn't handle sections that have a subsection and a variable with the same name. While this bug still remains, all remaining causes can be attributed to user error, since there are no defined variables gitcvs.ext and gitcvs.pserver. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-02Merge branch 'maint'Junio C Hamano1-1/+1
* maint: cvsserver: Handle re-added files correctly Fix compilation of test-delta
2007-05-02cvsserver: Handle re-added files correctlyFrank Lichtenheld1-1/+1
We can't unconditionally assign revision 1.1 to newly added files. In case the file did exist in the past and was deleted we need to honor the old revision number. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-17Merge branch 'fl/cvsserver'Junio C Hamano1-15/+94
* fl/cvsserver: config.txt: Add gitcvs.db* variables cvsserver: Document the GIT branches -> CVS modules mapping more prominently cvsserver: Reword documentation on necessity of write access cvsserver: Allow to "add" a removed file cvsserver: Add asciidoc documentation for new database backend configuration cvsserver: Corrections to the database backend configuration cvsserver: Use DBI->table_info instead of DBI->tables cvsserver: Abort if connect to database fails cvsserver: Make the database backend configurable cvsserver: Allow to override the configuration per access method cvsserver: Handle three part keys in git config correctly cvsserver: Introduce new state variable 'method' Conflicts: Documentation/config.txt
2007-04-12cvsserver: Allow to "add" a removed fileFrank Lichtenheld1-0/+40
CVS allows you to add a removed file (where the removal is not yet committed) which will cause the server to send the latest revision of the file and to delete the "removed" status. Copy this behaviour. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-11cvsserver: Fix handling of diappeared files on updateFrank Lichtenheld1-0/+1
Only send a modified response if the client sent a "Modified" entry. This fixes the case where the file was locally deleted on the client without being removed from CVS. In this case the client will only have sent the Entry for the file but nothing else. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Acked-by: Martin Langhoff <martin@catalyst.net.nz> Acked-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-07cvsserver: Corrections to the database backend configurationFrank Lichtenheld1-2/+4
Don't include the scheme name in gitcvs.dbdriver, it is always 'dbi' anyway. Don't allow ':' in driver names nor ';' in database names for sanity reasons. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-31cvsserver: Use DBI->table_info instead of DBI->tablesFrank Lichtenheld1-3/+1
DBI->table_info is portable across different DBD backends, DBI->tables is not. Limit the output to objects of type TABLE. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>
2007-03-22cvsserver: Abort if connect to database failsFrank Lichtenheld1-0/+1
Currently all calls to the database backend make no error checking or handling at all. At least abort if the connection to the database failed since there is really no way we could do anything useful after that. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-22cvsserver: Make the database backend configurableFrank Lichtenheld1-6/+34
Make all the different parts of the database backend connection configurable. This adds the following string configuration variables: - gitcvs.dbdriver - gitcvs.dbname - gitcvs.dbuser - gitcvs.dbpass The default values emulate the current behavior exactly for backwards compatibility. All configuration variables can also be specified for a specific access method (i.e. in the form gitcvs.<method>.<var>) The dbdriver/dbuser/dbpass variables are added for completness. No other backend than SQLite is tested yet. The dbname variable on the other hand is useful with this backend already (to not discriminate against other possible backends it was not splitted in dbdir and dbfile). Both dbname and dbuser support dynamic variable substitution where the available variables are: %m -- the CVS 'module' (i.e. GIT 'head') worked on %a -- CVS access method used (i.e. 'ext' or 'pserver') %u -- User name of the user invoking git-cvsserver %G -- .git directory name %g -- .git directory name, mangled to be used in a filename, currently this substitutes all chars except for [\w.-] with '_' Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-22cvsserver: Allow to override the configuration per access methodFrank Lichtenheld1-3/+7
Allow to override the gitcvs.enabled and gitcvs.logfile configuration variables for each access method (i.e. "ext" or "pserver") in the form gitcvs.<method>.<var> Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-22cvsserver: Handle three part keys in git config correctlyFrank Lichtenheld1-2/+6
This is intended to be used in the form gitcvs.<method>.<var> but this patch doesn't introduce any users yet. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-22cvsserver: Introduce new state variable 'method'Frank Lichtenheld1-1/+3
$state->{method} contains the CVS access method used, either 'ext' or 'pserver' Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14cvsserver: further improve messages on commit and statusFrank Lichtenheld1-3/+6
commit: Also print the old revision similar to how cvs does it and prepend a line stating the filename so that one can actually understand what happened when commiting more than one file. status: Fix the RCS filename displayed. The directory was printed twice. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-14cvsserver: Be more chattyFrank Lichtenheld1-0/+8
Submit some additional messages to the client on commit and update. Inspired by the standard CVS server though a little more terse. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-11cvsserver: Use Merged response instead of Update-existing for merged filesFrank Lichtenheld1-3/+3
Using Update-existing leads to the client forgetting about the "locally modified" status of the file which can lead to loss of local changes on later updates. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Acked-by: Martin Langhoff <martin.langhoff@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27cvsserver: Make always-binary mode a config file optionAndy Parkins1-9/+38
The config option gitcvs.allbinary may be set to force all entries to get the -kb flag. In the future the gitattributes system will probably be a more appropriate way of doing this, but that will easily slot in as the entries lines sent to the CVS client now have their kopts set via the function kopts_from_path(). In the interim it might be better to not just have a all-or-nothing approach, but rather detect based on file extension (or file contents?). That would slot in easily here as well. However, I personally prefer everything to be binary-safe, so I just switch the switch. Signed-off-by: Andy Parkins <andyparkins@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27cvsserver: Remove trailing "\n" from commithash in checkin functionAndy Parkins1-0/+1
The commithash for updating the ref is obtained from a call to git-commit-tree. However, it was returned (and stored) with the trailing newline. This meant that the later call to git-update-ref that was trying to update to $commithash was including the newline in the parameter - obviously that hash would never exist, and so git-update-ref would always fail. The solution is to chomp() the commithash as soon as it is returned by git-commit-tree. Signed-off-by: Andy Parkins <andyparkins@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-27Make 'cvs ci' lockless in git-cvsserver by using git-update-refJunio C Hamano1-27/+16
This makes "ci" codepath lockless by following the usual "remember the tip, do your thing, then compare and swap at the end" update pattern using update-ref. Incidentally, by updating the code that reads where the tip of the head is to use show-ref, it makes it safe to use in a repository whose refs are pack-pruned. I noticed that other parts of the program are not yet pack-refs safe, but tried to keep the changes to the minimum. Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-14Have git-cvsserver call hooks/update before really altering the refAndy Parkins1-0/+15
git-cvsserver is analogous to git-receive-pack; a checking from a cvs client to a central server is like a git-push from a working repository. Therefore it's nice to use the same access control (and email sending) that a receive-pack would perform. This patch tests for an executable update hook; if it is it is run with the ref being updated and the old and new hashes as normal. If the update hook returns an error code the update is aborted and the ref is never updated. The cvsserver returns "error 1" to the client to signal there was an EPERM error. Signed-off-by: Andy Parkins <andyparkins@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-28[PATCH] Rename git-repo-config to git-config.Tom Prince1-3/+3
Signed-off-by: Tom Prince <tom.prince@ualberta.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-24New files in git weren't being downloaded during CVS updateAndy Parkins1-3/+3
If a repository was checked out via git-cvsserver and then later a new file is added to the git repository via some other method; a CVS update wasn't fetching the new file. It would be reported as a new file as A some/dir/newfile.c but would never appear in the directory. The problem seems to be that git-cvsserver was treating these two cases identically, as "A" type results. 1. New file in repository 2. New file locally In fact, traditionally, case 1 is treated as a "U" result, and case 2 only is treated as an "A" result. "A", should just report that the file is added locally and then skip that file during an update as there is (of course) nothing to send. In both these cases there is no working revision, so the checking for "is there no working revision" will return true. The test for case 2 needs refining to say "if there is no working revision and no upstream revision". This patch does just that, leaving case 1 to be handled by the normal "U" handler. I've also updated the log message to more accurately describe the operation. i.e. that "A" means that content is scheduled for addition; not that it actually has been added. Signed-off-by: Andy Parkins <andyparkins@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08cvsserver: fix revision number during file addsMartin Langhoff1-1/+4
With this patch, cvs add / cvs commit echoes back to the client the correct file version (1.1) so that the file in the checkout is recognised as up-to-date. Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-08cvsserver: detect early of we are up to date and avoid costly rev-listMartin Langhoff1-1/+8
if the SHA1 of our head matches the last SHA1 seen in the DB, avoid further processing. [jc: an "Oops, please amend" patch rolled in] Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-19git-cvsserver: fix breakage when calling git merge-fileEric Wong1-1/+1
In the same vein as 8336afa563fbeff35e531396273065161181f04c, this fixes the the RCS merge to git-merge-file conversion in commit e2b70087. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-12Merge branch 'master' into js/mergeJunio C Hamano1-0/+1
* master: (42 commits) git-svn: correctly handle packed-refs in refs/remotes/ add test case for recursive merge git-svn: correctly display fatal() error messages git-svn: allow dcommit to take an alternate head git-svn: enable logging of information not supported by git Clarify fetch error for missing objects. Move Fink and Ports check to after config file shortlog: fix segfault on empty authorname shortlog: remove "[PATCH]" prefix from shortlog output Make sure the empty tree exists when needed in merge-recursive. Don't use memcpy when source and dest. buffers may overlap no need to install manpages as executable Documentation: simpler shared repository creation shortlog: fix segfault on empty authorname Add branch.*.merge warning and documentation update Fix perl/ build. git-svn: use do_switch for --follow-parent if the SVN library supports it Fix documentation copy&paste typo git-svn: extra error check to ensure we open a file correctly Documentation: update git-clone man page with new behavior ...
2006-12-12Get rid of the dependency on RCS' merge programJohannes Schindelin1-1/+1
Now that we have git-merge-file, an RCS merge lookalike, we no longer need it. So long, merge, and thanks for all the fish! Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-06cvsserver: Avoid miscounting bytes in Perl v5.8.xMartin Langhoff1-0/+1
At some point between v5.6 and 5.8 Perl started to assume its input, output and filehandles are UTF-8. This breaks the counting of bytes for the CVS protocol, resulting in the client expecting less data than we actually send, and storing truncated files. Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-11-11Merge branch 'maint'Junio C Hamano1-28/+35
* maint: git-cvsserver: read from git with -z to get non-ASCII pathnames.
2006-11-11git-cvsserver: read from git with -z to get non-ASCII pathnames.v1.4.3.5Junio C Hamano1-28/+35
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-22Use column indexes in git-cvsserver where necessary.Shawn Pearce1-1/+13
Tonight I found a git-cvsserver instance spending a lot of time in disk IO while trying to process operations against a Git repository with >30,000 objects contained in it. Blowing away my SQLLite database and rebuilding all tables with indexes on the attributes that git-cvsserver frequently runs queries against seems to have resolved the issue quite nicely. Since the indexes shouldn't hurt performance on small repositories and always helps on larger repositories we should just always create them when creating the revision storage tables. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-14cvsserver: fix "cvs diff" in a subdirectoryJohannes Schindelin1-1/+1
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-10-14cvsserver: Show correct letters for modified, removed and added filesJohannes Schindelin1-12/+51
Earlier, cvsserver showed always an 'U', sometimes even without a space between the 'U' and the name. Now, the correct letter is shown, with a space. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-26cvsserver: imitate git-update-ref when committingJohannes Schindelin1-4/+4
git-update-ref writes into the lockfile, and renames it afterwards. Like commit v1.3.0-rc3~22, it is not only cleaner, but also helps with shared setups: every developer can have a different primary group; what matters is that $GIT_DIR/refs/heads has to be writable by a group you are in. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-26git-cvsserver: support multiline commit messagesJohannes Schindelin1-3/+6
Earlier, cvsserver barfed when you tried to check in files with a multiline commit message. That is what Argumentx is for... Argument: lines can be followed by several Argumentx: lines, which means they should be appended. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-25cvsserver: avoid warning about active db handlesv1.4.2-rc2Johannes Schindelin1-14/+56
Turns out that DBD::SQLite does not favour preparing statements which are never executed. So, turn all 4 statements, which were prepared _always_, into methods, like the other 12 prepared statements. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-25cvsserver: suppress warningsJohannes Schindelin1-1/+1
This patch defines $state->{prependdir} as the empty string, so that quite a few warnings are avoided. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Acked-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-07-09Assorted typo fixesPavel Roskin1-7/+7
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-05-08Change to allow subdir updates from EclipseMartyn Smith1-11/+27
(Now you can rightclick any directory and select team-update/team-commit) and it should work
2006-05-08Many fixes for most operations in Eclipse.Martyn Smith1-82/+139
* Implemented global -n option * Implemented "Questionable" * Fixed Directory method, I _believe_ it's now correct in both cmdline and Eclipse. * Directory method Now looks for localdir of "." and compares the repo dir, uses THIS as a basis for all directory level calculations. * Added extra parameter to filenamesplit() to force stripping of "prepended" directory name. This ensures commits/updates etc work from any directory in the source tree. * Modified argsfromdir() so it is "always" called. This means that when the client specifies a directory, the method can detect this and behave accordingly (this is currently only implemented for the '.' directory) * Fixed "commit" method to correctly work from in a subdir
2006-05-08Added logged warnings for CVS error returnsMartyn Smith1-0/+2
2006-05-04cvsserver: use git-rev-list instead of git-logMartin Langhoff1-2/+3
On 5/4/06, Linus Torvalds <torvalds@osdl.org> wrote: > No it wasn't. "git log --parents" was definitely supposed to still work. > > That said, I suspect a git-cvsserver kind of usage is better off using > "git-rev-list --parents HEAD" instead, which didn't break in the first > place.
2006-04-25git-cvsserver: typofixesJunio C Hamano1-8/+8
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-24Deprecate usage of git-var -l for getting config vars listPetr Baudis1-3/+3
This has been an unfortunate sideway in the git API evolution. We use git-repo-config for all the other .git/config interaction so let's also use git-repo-config -l for the variable listing. Signed-off-by: Petr Baudis <pasky@suse.cz>
2006-03-04cvsserver: anonymous cvs via pserver supportMartin Langhoff1-0/+34
git-cvsserver now knows how to do the pserver auth chat when the user is anonymous. To get it to work, add a line to your inetd.conf like cvspserver stream tcp nowait nobody git-cvsserver pserver (On some inetd implementations you may have to put the pserver parameter twice.) Commits are blocked. Naively, git-cvsserver assumes non-malicious users. Please review the code before setting this up on an internet-accessible server. NOTE: the <nobody> user above will need write access to the .git directory to maintain the sqlite database. Updating of the sqlite database should be put in an update hook to avoid this problem, so that it is maintained by users with write access.
2006-03-03cvsserver: better error messagesMartin Langhoff1-1/+14
We now have different error messages when the repo is not found vs repo is not configured to allow gitcvs. Should help users during initial checkouts. Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-03cvsserver: nested directory creation fixups for Eclipse clientsMartin Langhoff1-17/+56
To create nested directories without (or before) sending file entries is rather tricky. Most clients just work. Eclipse, however, expects a very specific sequence of events. With this patch, cvsserver meets those expectations. Note: we may want to reuse prepdir() in req_update -- should move it outside of req_co. Right now prepdir() is tied to how req_co() works. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-02cvsserver: fix checkouts with -d <somedir>Martin Langhoff1-5/+5
A recent Eclipse compat fix broke checkouts with -d. Fix it so that the server sends the correct module name instead of the destination directory name.
2006-03-02cvsserver: checkout faster by sending files in a sensible orderMartin Langhoff1-2/+5
Just by sending the files in an ordered fashion, clients can process them much faster. And we can optimize our check of whether we created this directory already -- faster. Timings for a checkout on a commandline cvs client for a project with ~13K files totalling ~100MB: Unsorted: 603.12 real 16.89 user 42.88 sys Sorted: 298.19 real 26.37 user 42.42 sys
2006-03-01cvsserver: Eclipse compat -- now "compare with latest from HEAD" worksMartin Langhoff1-3/+24
The Eclipse client uses cvs update when that menu option is triggered. And doesn't like the standard cvs update response. Give it *exactly* what it wants. And hope the other clients don't lose the plot too badly. Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-01cvsserver: Checkout correctly on EclipseMartin Langhoff1-7/+26
Initial checkouts were failing to create Entries files under Eclipse. Eclipse was waiting for two non-standard directory-resets to prepare for a new directory from the server. This patch is tricky, because the same directory resets tend to confuse other clients. It's taken a bit of fiddling to get the commandline cvs client and Eclipse to get a good, clean checkout. Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-01cvsserver: Eclipse compat - browsing 'modules' (heads in our case) worksMartin Langhoff1-0/+20
Eclipse CVS clients have an odd way of perusing the top level of the repository, by calling update on module "". So reproduce cvs' odd behaviour in the interest of compatibility. It makes it much easier to get a checkout when using Eclipse.
2006-03-01cvsserver: Eclipse compat fixes - implement Questionable, alias rlog, add a ↵Martin Langhoff1-3/+21
space after the U A few things to satisfy Eclipse's strange habits as a cvs client: - Implement Questionable - Aliased rlog to log, but more work may be needed - Add a space after the U that indicates updated
2006-02-22Introducing git-cvsserver -- a CVS emulator for git.Martin Langhoff1-0/+2449
git-cvsserver is highly functional. However, not all methods are implemented, and for those methods that are implemented, not all switches are implemented. All the common read operations are implemented, and add/remove/commit are supported. Testing has been done using both the CLI CVS client, and the Eclipse CVS plugin. Most functionality works fine with both of these clients. Currently git-cvsserver only works over SSH connections, see the Documentation for more details on how to configure your client. It does not support pserver for anonymous access but it should not be hard to implement. Anonymous access will need tighter input validation. In our very informal tests, it seems to be significantly faster than a real CVS server. This utility depends on a version of git-cvsannotate that supports -S and on DBD::SQLite. Licensed under GPLv2. Copyright The Open University UK. Authors: Martyn Smith <martyn@catalyst.net.nz> Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>