1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-28 13:56:16 +02:00
Commit Graph

83 Commits

Author SHA1 Message Date
Lars Noschinski df4b3abc94 git-cvsserver: fix call to nonexistant cleanupWorkDir()
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-16 08:53:51 -07:00
Matthew Ogilvie 90948a4289 git-cvsserver: add ability to guess -kb from contents
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-16 12:05:35 -07:00
Matthew Ogilvie 8a06a63297 implement gitcvs.usecrlfattr
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-16 12:00:31 -07:00
Matthew Ogilvie 044182ef82 git-cvsserver: add mechanism for managing working tree and current directory
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-05-16 11:49:47 -07:00
Junio C Hamano e0efa033c8 Merge branch 'pb/cvsserver'
* pb/cvsserver:
  git-cvsserver: handle change type T
2008-04-02 00:22:20 -07:00
Junio C Hamano 22e885e6d8 Merge branch 'dd/cvsserver'
* 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-04-02 00:22:15 -07:00
Josh Elsasser 6aeeffd144 Allow git-cvsserver database table name prefix to be specified.
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-30 22:21:35 -07:00
Paolo Bonzini 9027efed47 git-cvsserver: handle change type T
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-27 23:51:33 -07:00
Damien Diederen c1bc30614a cvsserver: Use the user part of the email in log and annotate results
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-27 16:05:27 -07:00
Damien Diederen e78f69a3f2 cvsserver: Implement update -p (print to stdout)
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-27 16:05:27 -07:00
Damien Diederen 852b921c78 cvsserver: Do not include status output for subdirectories if -l is passed
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-27 16:05:27 -07:00
Damien Diederen 23b7180fdc cvsserver: Only print the file part of the filename in status header
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-27 16:05:27 -07:00
Damien Diederen 38bcd31a58 cvsserver: Respond to the 'editors' and 'watchers' commands
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-27 16:05:27 -07:00
Denis Cheng 9225d7be0a specify explicit "--pretty=medium" with `git log/show/whatchanged`
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-03-05 12:06:09 -08:00
Steffen Prohaska e509db990b cvsserver: Fix for histories with multiple roots
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>
2008-01-26 17:58:18 -08:00
Junio C Hamano 394d66d42b git-cvsserver runs hooks/post-update
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-05 01:15:01 -08:00
Michael Witten cdf63284de git-cvsserver runs hooks/post-receive
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-12-05 01:06:02 -08:00
Brian Gernhardt 2a4b5d5a07 cvsserver: Use exit 1 instead of die when req_Root fails.
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-10-18 03:02:15 -04:00
Brian Downing b50be1d80f cvsserver: Fix for work trees
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-08-08 22:16:46 -07:00
Jim Meyering a5e407988b git-cvsserver: detect/diagnose write failure, etc.
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-14 23:33:22 -07:00
Frank Lichtenheld 1e76b702c1 cvsserver: always initialize state in argsplit()
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-07-06 23:13:34 -07:00
Frank Lichtenheld 226bccb9ad cvsserver: Actually implement --export-all
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-15 22:38:48 -07:00
Frank Lichtenheld fd1cd91e94 cvsserver: Let --base-path and pserver get along just fine
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-15 22:38:45 -07:00
Frank Lichtenheld 693b63273e cvsserver: Add some useful commandline options
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-08 02:56:18 -07:00
Frank Lichtenheld 4890888d74 cvsserver: Make req_Root more critical of its input data
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-06-08 02:37:18 -07:00
Frank Lichtenheld 24a97d84ad cvsserver: Handle 'cvs login'
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-29 00:27:21 -07:00
Junio C Hamano 523d12e500 git-cvsserver: fix disabling service via per-method config
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-21 18:42:57 -07:00
Junio C Hamano e40a30452d git-cvsserver: exit with 1 upon "I HATE YOU"
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-20 00:19:48 -07:00
Frank Lichtenheld 460c6996e2 cvsserver: Don't send mixed messages to clients
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-13 23:57:27 -07:00
Frank Lichtenheld f987afa8fe cvsserver: Limit config parser to needed options
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-13 12:14:22 -07:00
Junio C Hamano 6644d2f2c4 Merge branch 'maint'
* maint:
  cvsserver: Handle re-added files correctly
  Fix compilation of test-delta
2007-05-02 11:27:31 -07:00
Frank Lichtenheld a7da9adb1f cvsserver: Handle re-added files correctly
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-05-02 10:41:52 -07:00
Junio C Hamano abbf594763 Merge branch 'fl/cvsserver'
* 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-17 22:17:46 -07:00
Frank Lichtenheld 4db0c8dec5 cvsserver: Allow to "add" a removed file
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-12 14:59:46 -07:00
Frank Lichtenheld cb52d9a1fb cvsserver: Fix handling of diappeared files on update
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-11 16:55:33 -07:00
Frank Lichtenheld 473937ed44 cvsserver: Corrections to the database backend configuration
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-04-07 23:02:13 -07:00
Frank Lichtenheld 0cf611a300 cvsserver: Use DBI->table_info instead of DBI->tables
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-31 16:09:49 -07:00
Frank Lichtenheld 920a449af5 cvsserver: Abort if connect to database fails
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-22 01:26:26 -07:00
Frank Lichtenheld eb1780d480 cvsserver: Make the database backend configurable
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-22 01:26:26 -07:00
Frank Lichtenheld d55820ced6 cvsserver: Allow to override the configuration per access method
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-22 01:26:26 -07:00
Frank Lichtenheld 92a39a14d0 cvsserver: Handle three part keys in git config correctly
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-22 01:26:26 -07:00
Frank Lichtenheld 80573baec4 cvsserver: Introduce new state variable 'method'
$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-22 01:26:26 -07:00
Frank Lichtenheld 392e28170b cvsserver: further improve messages on commit and status
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-14 02:09:33 -07:00
Frank Lichtenheld 459bad77e7 cvsserver: Be more chatty
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-14 02:09:32 -07:00
Frank Lichtenheld 538778469c cvsserver: Use Merged response instead of Update-existing for merged files
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-03-11 22:49:08 -07:00
Andy Parkins 8538e876b1 cvsserver: Make always-binary mode a config file option
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-27 16:01:58 -08:00
Andy Parkins 1872adabcc cvsserver: Remove trailing "\n" from commithash in checkin function
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-27 15:51:03 -08:00
Junio C Hamano ada5ef3b48 Make 'cvs ci' lockless in git-cvsserver by using git-update-ref
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-27 15:44:40 -08:00
Andy Parkins b2741f63d4 Have git-cvsserver call hooks/update before really altering the ref
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-02-14 02:15:42 -08:00
Tom Prince e0d10e1c63 [PATCH] Rename git-repo-config to git-config.
Signed-off-by: Tom Prince <tom.prince@ualberta.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-01-28 16:16:53 -08:00