{"thread":{"id":"17345","subject":"[PATCH 01/10] cvsserver: removed unused sha1Or-k mode from kopts_from_path","startedAt":"2009-01-24T23:43:11Z","lastAt":"2009-01-27T06:13:49Z","messageCount":16,"participants":["Matthew Ogilvie","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":10},"messages":[{"id":"101793","messageId":"1232840601-24696-1-git-send-email-mmogilvi_git@miniinfo.net","threadId":"17345","inReplyTo":null,"subject":"[PATCH 00/10] Misc. cvsserver, dashless, and test suite patches","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-01-24T23:43:11Z","receivedAt":"2009-01-24T23:43:11Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"This series of small patches fixes a few minor issues I noticed\nwhile researching what it would take to for cvsserver to support\ncvs's \"-r\" flags properly.  No real progress on the \"-r\" front,\nbut see comments in the \"cvsserver: add comments about database ...\"\nemail.\n\nThe \"run test suite without dashed...\" patch has wide scope,\neven though is is fairly small.  It (along with fixing the things it\nfound in t2300 and t3409) was inspired by a desire to avoid future\nregressions of the bug fixed in \"cvsserver: run dashless 'git commands'\"\npatch, where git-cvsserver was trying to run dashed commands that\nare not in the default PATH...\n\nAs this patch series was going to press, I noticed that\nthe \"run test suite without dashed...\" patch probably conflicts with\nrecently posted valgrind test suite patches.  See extra comments in\nthe email for possible resolutions.\n\nThe other patches in this series are mostly independent of each other.\n\nWhen working on the \"git-shell\" patch, I noticed a couple of other\nthings related to \"git-shell\" that maybe ought to be changed (change\nthe argc==2 special case, and document the best way(s) to\nconfigure an account to use git-shell).  See also extra information in\nthe email.\n\n--\nMatthew Ogilvie   [mmogilvi_git@miniinfo.net]\n\nMatthew Ogilvie (10):\n  cvsserver: removed unused sha1Or-k mode from kopts_from_path\n  cvsserver: add comments about database schema/usage\n  cvsserver: remove unused functions _headrev and gethistory\n  git-shell: allow running git-cvsserver, not just cvs\n  cvsserver: run dashless \"git command\"s to access plumbing\n  t2300: use documented technique to invoke git-sh-setup\n  t3409: use dashless \"git commit\" instead of \"git-commit\"\n  run test suite without dashed git-commands in PATH\n  Revert \"adapt git-cvsserver manpage to dash-free syntax\"\n  cvsserver doc: emphasize using CVS_SERVER= phrase within CVSROOT\n\n .gitignore                        |    1 +\n Documentation/git-cvsserver.txt   |   29 +++++--\n Documentation/git-shell.txt       |    5 +-\n Makefile                          |   40 +++++++---\n git-cvsserver.perl                |  163 ++++++++++++++++---------------------\n shell.c                           |    1 +\n t/t2300-cd-to-toplevel.sh         |    2 +-\n t/t3409-rebase-preserve-merges.sh |    6 +-\n t/t9400-git-cvsserver-server.sh   |   88 ++++++++++++++++++++\n t/test-lib.sh                     |   14 +++-\n test-bin-wrapper.sh               |   12 +++\n 11 files changed, 246 insertions(+), 115 deletions(-)\n create mode 100644 test-bin-wrapper.sh\n"},{"id":"101790","messageId":"1232840601-24696-2-git-send-email-mmogilvi_git@miniinfo.net","threadId":"17345","inReplyTo":"1232840601-24696-1-git-send-email-mmogilvi_git@miniinfo.net","subject":"[PATCH 01/10] cvsserver: removed unused sha1Or-k mode from kopts_from_path","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-01-24T23:43:12Z","receivedAt":"2009-01-24T23:43:12Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"sha1Or-k was a vestige from an early, never-released\nattempt to handle some oddball cases of CRLF conversion (-k option).\nUltimately it wasn't needed, and I should have gotten rid of it\nbefore submitting the CRLF patch in the first place.\n\nSee also 90948a42892779 (add ability to guess -kb from contents).\n\nSigned-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>\n---\n git-cvsserver.perl |   38 +++++---------------------------------\n 1 files changed, 5 insertions(+), 33 deletions(-)\n\ndiff --git a/git-cvsserver.perl b/git-cvsserver.perl\nindex fef7faf..1de0c1e 100755\n--- a/git-cvsserver.perl\n+++ b/git-cvsserver.perl\n@@ -2355,42 +2355,14 @@ sub kopts_from_path\n         }\n         elsif( ($cfg->{gitcvs}{allbinary} =~ /^\\s*guess\\s*$/i) )\n         {\n-            if( $srcType eq \"sha1Or-k\" &&\n-                !defined($name) )\n+            if( is_binary($srcType,$name) )\n             {\n-                my ($ret)=$state->{entries}{$path}{options};\n-                if( !defined($ret) )\n-                {\n-                    $ret=$state->{opt}{k};\n-                    if(defined($ret))\n-                    {\n-                        $ret=\"-k$ret\";\n-                    }\n-                    else\n-                    {\n-                        $ret=\"\";\n-                    }\n-                }\n-                if( ! ($ret=~/^(|-kb|-kkv|-kkvl|-kk|-ko|-kv)$/) )\n-                {\n-                    print \"E Bad -k option\\n\";\n-                    $log->warn(\"Bad -k option: $ret\");\n-                    die \"Error: Bad -k option: $ret\\n\";\n-                }\n-\n-                return $ret;\n+                $log->debug(\"... as binary\");\n+                return \"-kb\";\n             }\n             else\n             {\n-                if( is_binary($srcType,$name) )\n-                {\n-                    $log->debug(\"... as binary\");\n-                    return \"-kb\";\n-                }\n-                else\n-                {\n-                    $log->debug(\"... as text\");\n-                }\n+                $log->debug(\"... as text\");\n             }\n         }\n     }\n@@ -2497,7 +2469,7 @@ sub open_blob_or_die\n             die \"Unable to open file $name: $!\\n\";\n         }\n     }\n-    elsif( $srcType eq \"sha1\" || $srcType eq \"sha1Or-k\" )\n+    elsif( $srcType eq \"sha1\" )\n     {\n         unless ( defined ( $name ) and $name =~ /^[a-zA-Z0-9]{40}$/ )\n         {\n-- \n1.6.1.81.g9833d.dirty\n"},{"id":"101791","messageId":"1232840601-24696-3-git-send-email-mmogilvi_git@miniinfo.net","threadId":"17345","inReplyTo":"1232840601-24696-2-git-send-email-mmogilvi_git@miniinfo.net","subject":"[PATCH 02/10] cvsserver: add comments about database schema/usage","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-01-24T23:43:13Z","receivedAt":"2009-01-24T23:43:13Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"No functionality changes, but these comments should make it easier to\nunderstand how it works.\n\nSigned-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>\n---\n\nThis is the result of some initial research into what it would\ntake to support switching branches/tags/commithashes for the entire\nsandbox using \"cvs update -r TAG\".  This seems like the one remaining\nbig missing feature that makes git-cvsserver a substantial downgrade\ncompared to a real CVS server.\n\ngit-cvsserver's support for cvs's \"-r\" arguments is kind of hit\nor miss:\n   - Some commands ignore it completely.  This includes \"checkout\",\n     but checkout does have a kind of workaround: you can checkout\n     any branch by specifying \"cvs checkout branch\".  (Normally\n     it is \"cvs checkout module\".)  But that sandbox is then locked\n     to that branch, you can't switch to another.\n   - Some commands (e.g. update) allow you to specify CVS-style\n     version numbers with -r, but that is generally only useful if\n     you are examining a single file.\n   - Some of those commands also recognize git commit hashes.  But\n     due to the internal database model, the commithash form will only\n     work for files that were actually modified in the requested\n     commit, and for which cvsserver has previously decided that\n     the commit is on the same branch that the sandbox\n     is locked to (it has already assigned CVS revision numbers\n     for it).  Other commands (including update) do not recognize\n     the commithash form at all (ignores it if it doesn't look like\n     a CVS version number, even though the underlying getmeta()\n     function is more a little more general).\n\nEven the relatively simple goal of being able to update to an\nolder version on the same branch involves some significant costs:\n   - Perhaps store O(numCommits*totalNumFiles) entries in the\n     revision table, instead of the current more reasonable\n     O(numCommits*averageNumChangedFilesPerCommit).  Perhaps\n     this could be combined with a significant schema change that\n     involves assigning short ints to distinct commithash\n     values and distinct filenames, looking up author/mode\n     information directly in git on demand, and just storing the\n     short ints in the revisions table to shrink each row\n     as much as possible.\n   - Fork off extra git commands to find the most recent\n     commit (relative to the supplied commit) that modified each\n     file, then look that up in the DB.  For many files, it\n     is likely to have to search quite a ways, and if it the search\n     is done with a separate command per file, it could\n     get expensive.  Also watch out for \"other\"\n     branches that won't be in the DB.  Sounds like a lot\n     of extra CPU usage re-parsing commit history for every\n     file...\n\nThoughts about full branch support in cvsserver:\n   - One way would be to add a \"branch\" column to the \"revisions\"\n     and \"headers\" tables.  Also add a branch table (details TBD)?\n   - Alternatively, drop the DB and see if maybe we could store\n     file revision number information using git's core data structures:\n     \"refs/cvsfileversions/{branch}\", with a tree structure for storing\n     file revision number to commithash/path mappings that is\n     specifically designed to use the strengths of the DAG\n     representation and pack files.\n   - I have vague notions of other techniques as well.\n   - Recognise that names of branches may change as heads advance\n     and things get merged, but the CVS branch /number/ needs\n     to remain consistent.\n   - Recognize that in general you can not reliably regenerate\n     the DB.  Depending on what sequence of git-cvsserver and\n     git-merge commands, versions of files can end up with\n     different CVS revision numbers.\n   - Has anyone thought about implementing server emulators for\n     other version control systems (git-svnserver and similar)?\n\n--\nMatthew Ogilvie   [mmogilvi_git@miniinfo.net]\n\n git-cvsserver.perl |   46 ++++++++++++++++++++++++++++++++++++++++++----\n 1 files changed, 42 insertions(+), 4 deletions(-)\n\ndiff --git a/git-cvsserver.perl b/git-cvsserver.perl\nindex 1de0c1e..f7891b8 100755\n--- a/git-cvsserver.perl\n+++ b/git-cvsserver.perl\n@@ -2045,6 +2045,10 @@ sub statecleanup\n     $state->{entries} = {};\n }\n \n+# Return working directory revision int \"X\" from CVS revision \"1.X\" out\n+# of the the working directory \"entries\" state, for the given filename.\n+# Return negative \"X\" to represent the file is scheduled for removal\n+# when it is committed.\n sub revparse\n {\n     my $filename = shift;\n@@ -2775,6 +2779,16 @@ sub new\n     }\n \n     # Construct the revision table if required\n+    # The revision table stores an entry for each file, each time that file\n+    # changes.\n+    #   numberOfRecords = O( numCommits * averageNumChangedFilesPerCommit )\n+    # This is not sufficient to support \"-r {commithash}\" for any\n+    # files except files that were modified by that commit (also,\n+    # some places in the code ignore/effectively strip out -r in\n+    # some cases, before it gets passed to getmeta()).\n+    # The \"filehash\" field typically has a git blob hash, but can also\n+    # be set to \"dead\" to indicate that the given version of the file\n+    # should not exist in the sandbox.\n     unless ( $self->{tables}{$self->tablename(\"revision\")} )\n     {\n         my $tablename = $self->tablename(\"revision\");\n@@ -2802,6 +2816,15 @@ sub new\n     }\n \n     # Construct the head table if required\n+    # The head table (along with the \"last_commit\" entry in the property\n+    # table) is the persisted working state of the \"sub update\" subroutine.\n+    # All of it's data is read entirely first, and completely recreated\n+    # last, every time \"sub update\" runs.\n+    # This is also used by \"sub getmeta\" when it is asked for the latest\n+    # version of a file (as opposed to some specific version).\n+    # Another way of thinking about it is as a single slice out of\n+    # \"revisions\", giving just the most recent revision information for\n+    # each file.\n     unless ( $self->{tables}{$self->tablename(\"head\")} )\n     {\n         my $tablename = $self->tablename(\"head\");\n@@ -2824,6 +2847,7 @@ sub new\n     }\n \n     # Construct the properties table if required\n+    #  - \"last_commit\" - Used by \"sub update\".\n     unless ( $self->{tables}{$self->tablename(\"properties\")} )\n     {\n         my $tablename = $self->tablename(\"properties\");\n@@ -2836,6 +2860,11 @@ sub new\n     }\n \n     # Construct the commitmsgs table if required\n+    # The commitmsgs table is only used for merge commits, since\n+    # \"sub update\" will only keep one branch of parents.  Shortlogs\n+    # for ignored commits (i.e. not on the chosen branch) will be used\n+    # to construct a replacement \"collapsed\" merge commit message,\n+    # which will be stored in this table.  See also \"sub commitmessage\".\n     unless ( $self->{tables}{$self->tablename(\"commitmsgs\")} )\n     {\n         my $tablename = $self->tablename(\"commitmsgs\");\n@@ -2867,6 +2896,14 @@ sub tablename\n \n =head2 update\n \n+Bring the database up to date with the latest changes from\n+the git repository.\n+\n+Internal working state is read out of the \"head\" table and the\n+\"last_commit\" property, then it updates \"revisions\" based on that, and\n+finally it writes the new internal state back to the \"head\" table\n+so it can be used as a starting point the next time update is called.\n+\n =cut\n sub update\n {\n@@ -2980,17 +3017,18 @@ sub update\n                 next;\n             } elsif (@{$commit->{parents}} > 1) {\n                 # it is a merge commit, for each parent that is\n-                # not $lastpicked, see if we can get a log\n+                # not $lastpicked (not given a CVS revision number),\n+                # see if we can get a log\n                 # from the merge-base to that parent to put it\n                 # in the message as a merge summary.\n                 my @parents = @{$commit->{parents}};\n                 foreach my $parent (@parents) {\n-                    # git-merge-base can potentially (but rarely) throw\n-                    # several candidate merge bases. let's assume\n-                    # that the first one is the best one.\n                     if ($parent eq $lastpicked) {\n                         next;\n                     }\n+                    # git-merge-base can potentially (but rarely) throw\n+                    # several candidate merge bases. let's assume\n+                    # that the first one is the best one.\n \t\t    my $base = eval {\n \t\t\t    safe_pipe_capture('git-merge-base',\n \t\t\t\t\t\t $lastpicked, $parent);\n-- \n1.6.1.81.g9833d.dirty\n"},{"id":"101798","messageId":"1232840601-24696-4-git-send-email-mmogilvi_git@miniinfo.net","threadId":"17345","inReplyTo":"1232840601-24696-3-git-send-email-mmogilvi_git@miniinfo.net","subject":"[PATCH 03/10] cvsserver: remove unused functions _headrev and gethistory","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-01-24T23:43:14Z","receivedAt":"2009-01-24T23:43:14Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"Remove:\n   - _headrev() - cvsserver already uses similar functionality\n     from getmeta() and gethead().\n   - gethistory() - cvsserver already uses similar functions\n     gethistorydense() and getlog().\n   - #'annotate' comment  - Uncommented annotate line is 2 lines earlier.\n\nSigned-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>\n---\n git-cvsserver.perl |   37 ++++---------------------------------\n 1 files changed, 4 insertions(+), 33 deletions(-)\n\ndiff --git a/git-cvsserver.perl b/git-cvsserver.perl\nindex f7891b8..fe23b49 100755\n--- a/git-cvsserver.perl\n+++ b/git-cvsserver.perl\n@@ -78,7 +78,6 @@ my $methods = {\n     'editors'         => \\&req_EMPTY,\n     'annotate'        => \\&req_annotate,\n     'Global_option'   => \\&req_Globaloption,\n-    #'annotate'        => \\&req_CATCHALL,\n };\n \n ##############################################\n@@ -3310,19 +3309,6 @@ sub insert_head\n     $insert_head->execute($name, $revision, $filehash, $commithash, $modified, $author, $mode);\n }\n \n-sub _headrev\n-{\n-    my $self = shift;\n-    my $filename = shift;\n-    my $tablename = $self->tablename(\"head\");\n-\n-    my $db_query = $self->{dbh}->prepare_cached(\"SELECT filehash, revision, mode FROM $tablename WHERE name=?\",{},1);\n-    $db_query->execute($filename);\n-    my ( $hash, $revision, $mode ) = $db_query->fetchrow_array;\n-\n-    return ( $hash, $revision, $mode );\n-}\n-\n sub _get_prop\n {\n     my $self = shift;\n@@ -3382,6 +3368,8 @@ sub gethead\n \n =head2 getlog\n \n+See also gethistorydense().\n+\n =cut\n \n sub getlog\n@@ -3467,25 +3455,6 @@ sub commitmessage\n     return $message;\n }\n \n-=head2 gethistory\n-\n-This function takes a filename (with path) argument and returns an arrayofarrays\n-containing revision,filehash,commithash ordered by revision descending\n-\n-=cut\n-sub gethistory\n-{\n-    my $self = shift;\n-    my $filename = shift;\n-    my $tablename = $self->tablename(\"revision\");\n-\n-    my $db_query;\n-    $db_query = $self->{dbh}->prepare_cached(\"SELECT revision, filehash, commithash FROM $tablename WHERE name=? ORDER BY revision DESC\",{},1);\n-    $db_query->execute($filename);\n-\n-    return $db_query->fetchall_arrayref;\n-}\n-\n =head2 gethistorydense\n \n This function takes a filename (with path) argument and returns an arrayofarrays\n@@ -3495,6 +3464,8 @@ This version of gethistory skips deleted entries -- so it is useful for annotate\n The 'dense' part is a reference to a '--dense' option available for git-rev-list\n and other git tools that depend on it.\n \n+See also getlog().\n+\n =cut\n sub gethistorydense\n {\n-- \n1.6.1.81.g9833d.dirty\n"},{"id":"101792","messageId":"1232840601-24696-5-git-send-email-mmogilvi_git@miniinfo.net","threadId":"17345","inReplyTo":"1232840601-24696-4-git-send-email-mmogilvi_git@miniinfo.net","subject":"[PATCH 04/10] git-shell: allow running git-cvsserver, not just cvs","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-01-24T23:43:15Z","receivedAt":"2009-01-24T23:43:15Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"Add the ability to ask a git-shell restricted account to explicitly run\ngit-cvsserver, instead of requesting a fake \"cvs\".  With this, an account\ncould be reconfigured to use/not use git-shell without requiring\nchanges to client side configuration.  It also avoids confusing\nusers about which way cvs should be configured; if cvs is accessing\na git repository, always set CVS_SERVER=git-cvsserver.\n\nSigned-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>\n---\n\n--------------\nQuestion 1:\n\nThere is a surprising shortage of solid information about the\nbest way(s) restrict what commands can be run by ssh accounts,\nboth in general and for git specifically.  Is\nputting git-shell in /etc/passwd the best way?  Are there other ways,\njust as good or better?\n\nPerhaps someone who really knows could add something to the git-shell.txt\nman page describing the possible way(s) to configure an account to\nbe restricted to git-shell.\n\n--------------\nQuestion 2:\n\nAs near as I can tell, git-shell as run by sshd is typically\ninvoked such that it ends up with an argv with 3 arguments of the\nform (\"git-shell\",\"-c\",\"command arguments\"). \nBut the (argc==2 \"cvs server\") special case near line 69 of shell.c\nappears to allow the middle argument (\"-c\") to be missing, but\nonly for \"cvs server\".\n\nMy question is, why was this special case put there?  Is a remnant of\nan imperfect ad-hoc test framework someone used, or is there a\nlegitimate configuration where the \"-c\" is missing?\n\nIt seems to me that either this missing \"-c\" case should be\neliminated, or it should be made more general: If some\nconfiguration of sshd leaves out the \"-c\", then it probably\nleaves it out for anything you try to invoke, not just\n\"cvs server\".\n\n--------------\nHints about testing:\n\nIn addition to the test cases that are included in the patch, I tested\nthis by setting up an extra user account with the following\nshell script set as the shell in /etc/passwd (yes, a shell script\nis my shell...).  This allows me to tweak enviornment variables,\nlog how it is invoked, maybe tee off the stdin/stdout, etc:\n\n---CUT---\n#!/bin/sh\n\nlog()\n{ echo \"$1\" >> remote.log\n}\n\nlog \"------------\"\nlog \"\"\nlog \"cmd:$0\"\nfor arg in \"$@\" ; do\n  log \"arg:$arg\"\ndone\n\nPATH=\"/path/to/version/to/test:$PATH\"\nlog \"path: $PATH\"\n#tee input.out | git-shell \"$@\" | tee output.out\nexec git-shell \"$@\"\n---CUT---\n\nBut note that you probably do NOT want to route through a\nwrapper like this for production...\n\n--\nMatthew Ogilvie   [mmogilvi_git@miniinfo.net]\n\n Documentation/git-cvsserver.txt |    7 ++-\n Documentation/git-shell.txt     |    5 +-\n shell.c                         |    1 +\n t/t9400-git-cvsserver-server.sh |   88 +++++++++++++++++++++++++++++++++++++++\n 4 files changed, 97 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt\nindex 785779e..e32ad7b 100644\n--- a/Documentation/git-cvsserver.txt\n+++ b/Documentation/git-cvsserver.txt\n@@ -113,9 +113,12 @@ cvs -d \":ext;CVS_SERVER=git cvsserver:user@server/path/repo.git\" co <HEAD_name>\n ------\n This has the advantage that it will be saved in your 'CVS/Root' files and\n you don't need to worry about always setting the correct environment\n-variable.  SSH users restricted to 'git-shell' don't need to override the default\n-with CVS_SERVER (and shouldn't) as 'git-shell' understands `cvs` to mean\n+variable.  SSH users restricted to 'git-shell' do not need to\n+override CVS_SERVER as 'git-cvsserver' because\n+'git-shell' understands `cvs` to mean\n 'git-cvsserver' and pretends that the other end runs the real 'cvs' better.\n+But restricted users can still override it for consistency and to avoid\n+reconfiguration if they are later promoted to full SSH access.\n --\n 2. For each repo that you want accessible from CVS you need to edit config in\n    the repo and add the following section.\ndiff --git a/Documentation/git-shell.txt b/Documentation/git-shell.txt\nindex 3f8d973..68cb834 100644\n--- a/Documentation/git-shell.txt\n+++ b/Documentation/git-shell.txt\n@@ -18,8 +18,9 @@ of server-side GIT commands implementing the pull/push functionality.\n The commands can be executed only by the '-c' option; the shell is not\n interactive.\n \n-Currently, only three commands are permitted to be called, 'git-receive-pack'\n-'git-upload-pack' with a single required argument or 'cvs server' (to invoke\n+Currently, only four commands are permitted to be called, 'git-receive-pack'\n+'git-upload-pack' with a single required argument,\n+'git-cvsserver server', or 'cvs server' (to invoke\n 'git-cvsserver').\n \n Author\ndiff --git a/shell.c b/shell.c\nindex e339369..6ed960f 100644\n--- a/shell.c\n+++ b/shell.c\n@@ -40,6 +40,7 @@ static struct commands {\n } cmd_list[] = {\n \t{ \"git-receive-pack\", do_generic_cmd },\n \t{ \"git-upload-pack\", do_generic_cmd },\n+\t{ \"git-cvsserver\", do_cvs_cmd },\n \t{ \"cvs\", do_cvs_cmd },\n \t{ NULL },\n };\ndiff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh\nindex 6a37f71..b23a774 100755\n--- a/t/t9400-git-cvsserver-server.sh\n+++ b/t/t9400-git-cvsserver-server.sh\n@@ -501,4 +501,92 @@ test_expect_success 'cvs annotate' '\n     test_cmp ../expect ../actual\n '\n \n+#------------\n+# access server through git-shell:\n+#------------\n+\n+cd \"$WORKDIR\"\n+test_expect_success 'setup fake_ssh' '\n+    cd cvswork &&\n+    ( echo \"#!/bin/sh\" &&\n+      echo \"echo \\\"cmd:\\$*\\\" >> fake_ssh_sh.log\" &&\n+      echo \"if test x\\\"\\$1 \\$2 \\$3\\\" = x\\\"-l user machine\\\" ; then\" &&\n+      echo \"  shift ; shift ; shift\" &&\n+      echo \"  exec /bin/sh -c \\\"\\$*\\\"\" &&\n+      echo \"fi\" &&\n+      echo \"echo FAIL\" &&\n+      echo \"exit 1\"\n+    ) > fake_ssh_sh &&\n+    ( echo \"#!/bin/sh\" &&\n+      echo \"echo \\\"cmd:\\$*\\\" >> fake_ssh_git-shell.log\" &&\n+      echo \"if test x\\\"\\$1 \\$2 \\$3\\\" = x\\\"-l user machine\\\" ; then\" &&\n+      echo \"  shift ; shift ; shift\" &&\n+      echo \"  exec git-shell -c \\\"\\$*\\\"\"\n+      echo \"fi\" &&\n+      echo \"echo FAIL\" &&\n+      echo \"exit 1\"\n+    ) > fake_ssh_git-shell &&\n+    chmod +x fake_ssh_sh fake_ssh_git-shell\n+'\n+\n+cd \"$WORKDIR\"\n+test_expect_success 'fake_ssh ... sh git-cvsserver' '\n+    ( cd cvswork &&\n+      CVS_SERVER=\"git-cvsserver\" &&\n+      CVS_RSH=\"./fake_ssh_sh\" &&\n+      CVSROOT=\":ext:user@machine$SERVERDIR\" &&\n+      export CVS_SERVER CVS_RSH CVSROOT &&\n+      GIT_CONFIG=\"$git_config\" cvs -d \"$CVSROOT\" up -p status.file > ../out &&\n+      cmp status.file ../out\n+    )\n+'\n+\n+cd \"$WORKDIR\"\n+test_expect_success 'fake_ssh ... sh git cvsserver' '\n+    ( cd cvswork &&\n+      CVS_SERVER=\"git cvsserver\" &&\n+      CVS_RSH=\"./fake_ssh_sh\" &&\n+      CVSROOT=\":ext:user@machine$SERVERDIR\" &&\n+      export CVS_SERVER CVS_RSH CVSROOT &&\n+      GIT_CONFIG=\"$git_config\" cvs -d \"$CVSROOT\" up -p status.file > ../out &&\n+      cmp status.file ../out\n+    )\n+'\n+\n+cd \"$WORKDIR\"\n+test_expect_success 'fake_ssh ... git-shell git-cvsserver' '\n+    ( cd cvswork &&\n+      CVS_SERVER=\"git-cvsserver\" &&\n+      CVS_RSH=\"./fake_ssh_git-shell\" &&\n+      CVSROOT=\":ext:user@machine$SERVERDIR\" &&\n+      export CVS_SERVER CVS_RSH CVSROOT &&\n+      GIT_CONFIG=\"$git_config\" cvs -d \"$CVSROOT\" up -p status.file > ../out &&\n+      cmp status.file ../out\n+    )\n+'\n+\n+cd \"$WORKDIR\"\n+test_expect_success 'fake_ssh ... git-shell git cvsserver' '\n+    ( cd cvswork &&\n+      CVS_SERVER=\"git cvsserver\" &&\n+      CVS_RSH=\"./fake_ssh_git-shell\" &&\n+      CVSROOT=\":ext:user@machine$SERVERDIR\" &&\n+      export CVS_SERVER CVS_RSH CVSROOT &&\n+      GIT_CONFIG=\"$git_config\" cvs -d \"$CVSROOT\" up -p status.file > ../out &&\n+      cmp status.file ../out\n+    )\n+'\n+\n+cd \"$WORKDIR\"\n+test_expect_success 'fake_ssh ... git-shell cvs' '\n+    ( cd cvswork &&\n+      CVS_SERVER=\"cvs\" &&\n+      CVS_RSH=\"./fake_ssh_git-shell\" &&\n+      CVSROOT=\":ext:user@machine$SERVERDIR\" &&\n+      export CVS_SERVER CVS_RSH CVSROOT &&\n+      GIT_CONFIG=\"$git_config\" cvs -d \"$CVSROOT\" up -p status.file > ../out &&\n+      cmp status.file ../out\n+    )\n+'\n+\n test_done\n-- \n1.6.1.81.g9833d.dirty\n"},{"id":"101795","messageId":"1232840601-24696-6-git-send-email-mmogilvi_git@miniinfo.net","threadId":"17345","inReplyTo":"1232840601-24696-5-git-send-email-mmogilvi_git@miniinfo.net","subject":"[PATCH 05/10] cvsserver: run dashless \"git command\"s to access plumbing","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-01-24T23:43:16Z","receivedAt":"2009-01-24T23:43:16Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"git-cvsserver has been installed in the default $(bindir)\nsince 1df2a1ce806, but if you actually invoke it that way\n(CVS_SERVER=git-cvsserver), it was failing because most of the\ndashed-form plumbing commands cvsserver invokes are not in the PATH.\n\nIt seems best not to just switch to pure CVS_SERVER=\"git cvsserver\",\nwhich does not work with cvs's \":fork:\" connection scheme.  In\nthis case \"cvs\" presumably uses the whole value as argv[0] for\nexec(), and of course no execuable named \"git cvsserver\" exists.\n\nBut both settings worked under some circumstances:\n\nCVS_SERVER=\"git cvsserver\" works OK for cvs's \":ext:\" scheme (at\nleast with ssh), presumably because of how sshd invokes\n/bin/sh -c \"{args}\" with limited quoting, and \"git\"\nwould set up the PATH so that cvsserver could run dashed commands\ncorrectly.\n\nAlso, CVS_SERVER=\"git-cvsserver\" has been working OK under git's test\nframework, because the test framework currently always sets up a PATH\nthat includes the dashed forms.\n\nSigned-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>\n---\n\nNote: I only changed the actual command invocations; I left error\nmessages and comments as-is.  Should they be changed as well?\n\n--\nMatthew Ogilvie   [mmogilvi_git@miniinfo.net]\n\n git-cvsserver.perl |   40 ++++++++++++++++++++--------------------\n 1 files changed, 20 insertions(+), 20 deletions(-)\n\ndiff --git a/git-cvsserver.perl b/git-cvsserver.perl\nindex fe23b49..8e9e659 100755\n--- a/git-cvsserver.perl\n+++ b/git-cvsserver.perl\n@@ -283,7 +283,7 @@ sub req_Root\n        return 0;\n     }\n \n-    my @gitvars = `git-config -l`;\n+    my @gitvars = `git config -l`;\n     if ($?) {\n        print \"E problems executing git-config on the server -- this is not a git repository or the PATH is not set correctly.\\n\";\n         print \"E \\n\";\n@@ -700,7 +700,7 @@ sub req_Modified\n     # Save the file data in $state\n     $state->{entries}{$state->{directory}.$data}{modified_filename} = $filename;\n     $state->{entries}{$state->{directory}.$data}{modified_mode} = $mode;\n-    $state->{entries}{$state->{directory}.$data}{modified_hash} = `git-hash-object $filename`;\n+    $state->{entries}{$state->{directory}.$data}{modified_hash} = `git hash-object $filename`;\n     $state->{entries}{$state->{directory}.$data}{modified_hash} =~ s/\\s.*$//s;\n \n     #$log->debug(\"req_Modified : file=$data mode=$mode size=$size\");\n@@ -1287,7 +1287,7 @@ sub req_ci\n \n \t# do a checkout of the file if it is part of this tree\n         if ($wrev) {\n-            system('git-checkout-index', '-f', '-u', $filename);\n+            system('git', 'checkout-index', '-f', '-u', $filename);\n             unless ($? == 0) {\n                 die \"Error running git-checkout-index -f -u $filename : $!\";\n             }\n@@ -1329,15 +1329,15 @@ sub req_ci\n         {\n             $log->info(\"Removing file '$filename'\");\n             unlink($filename);\n-            system(\"git-update-index\", \"--remove\", $filename);\n+            system(\"git\", \"update-index\", \"--remove\", $filename);\n         }\n         elsif ( $addflag )\n         {\n             $log->info(\"Adding file '$filename'\");\n-            system(\"git-update-index\", \"--add\", $filename);\n+            system(\"git\", \"update-index\", \"--add\", $filename);\n         } else {\n             $log->info(\"Updating file '$filename'\");\n-            system(\"git-update-index\", $filename);\n+            system(\"git\", \"update-index\", $filename);\n         }\n     }\n \n@@ -1349,7 +1349,7 @@ sub req_ci\n         return;\n     }\n \n-    my $treehash = `git-write-tree`;\n+    my $treehash = `git write-tree`;\n     chomp $treehash;\n \n     $log->debug(\"Treehash : $treehash, Parenthash : $parenthash\");\n@@ -1366,7 +1366,7 @@ sub req_ci\n     }\n     close $msg_fh;\n \n-    my $commithash = `git-commit-tree $treehash -p $parenthash < $msg_filename`;\n+    my $commithash = `git commit-tree $treehash -p $parenthash < $msg_filename`;\n     chomp($commithash);\n     $log->info(\"Commit hash : $commithash\");\n \n@@ -1819,7 +1819,7 @@ sub req_annotate\n \t# TODO: if we got a revision from the client, use that instead\n \t# to look up the commithash in sqlite (still good to default to\n \t# the current head as we do now)\n-\tsystem(\"git-read-tree\", $lastseenin);\n+\tsystem(\"git\", \"read-tree\", $lastseenin);\n \tunless ($? == 0)\n \t{\n \t    print \"E error running git-read-tree $lastseenin $ENV{GIT_INDEX_FILE} $!\\n\";\n@@ -1828,7 +1828,7 @@ sub req_annotate\n \t$log->info(\"Created index '$ENV{GIT_INDEX_FILE}' with commit $lastseenin - exit status $?\");\n \n         # do a checkout of the file\n-        system('git-checkout-index', '-f', '-u', $filename);\n+        system('git', 'checkout-index', '-f', '-u', $filename);\n         unless ($? == 0) {\n             print \"E error running git-checkout-index -f -u $filename : $!\\n\";\n             return;\n@@ -1859,7 +1859,7 @@ sub req_annotate\n         close ANNOTATEHINTS\n             or (print \"E failed to write $a_hints: $!\\n\"), return;\n \n-        my @cmd = (qw(git-annotate -l -S), $a_hints, $filename);\n+        my @cmd = (qw(git annotate -l -S), $a_hints, $filename);\n         if (!open(ANNOTATE, \"-|\", @cmd)) {\n             print \"E error invoking \". join(' ',@cmd) .\": $!\\n\";\n             return;\n@@ -2080,17 +2080,17 @@ sub transmitfile\n \n     die \"Need filehash\" unless ( defined ( $filehash ) and $filehash =~ /^[a-zA-Z0-9]{40}$/ );\n \n-    my $type = `git-cat-file -t $filehash`;\n+    my $type = `git cat-file -t $filehash`;\n     chomp $type;\n \n     die ( \"Invalid type '$type' (expected 'blob')\" ) unless ( defined ( $type ) and $type eq \"blob\" );\n \n-    my $size = `git-cat-file -s $filehash`;\n+    my $size = `git cat-file -s $filehash`;\n     chomp $size;\n \n     $log->debug(\"transmitfile($filehash) size=$size, type=$type\");\n \n-    if ( open my $fh, '-|', \"git-cat-file\", \"blob\", $filehash )\n+    if ( open my $fh, '-|', \"git\", \"cat-file\", \"blob\", $filehash )\n     {\n         if ( defined ( $options->{targetfile} ) )\n         {\n@@ -2942,7 +2942,7 @@ sub update\n         push @git_log_params, $self->{module};\n     }\n     # git-rev-list is the backend / plumbing version of git-log\n-    open(GITLOG, '-|', 'git-rev-list', @git_log_params) or die \"Cannot call git-rev-list: $!\";\n+    open(GITLOG, '-|', 'git', 'rev-list', @git_log_params) or die \"Cannot call git-rev-list: $!\";\n \n     my @commits;\n \n@@ -3029,7 +3029,7 @@ sub update\n                     # several candidate merge bases. let's assume\n                     # that the first one is the best one.\n \t\t    my $base = eval {\n-\t\t\t    safe_pipe_capture('git-merge-base',\n+\t\t\t    safe_pipe_capture('git', 'merge-base',\n \t\t\t\t\t\t $lastpicked, $parent);\n \t\t    };\n \t\t    # The two branches may not be related at all,\n@@ -3041,7 +3041,7 @@ sub update\n                     if ($base) {\n                         my @merged;\n                         # print \"want to log between  $base $parent \\n\";\n-                        open(GITLOG, '-|', 'git-log', '--pretty=medium', \"$base..$parent\")\n+                        open(GITLOG, '-|', 'git', 'log', '--pretty=medium', \"$base..$parent\")\n \t\t\t  or die \"Cannot call git-log: $!\";\n                         my $mergedhash;\n                         while (<GITLOG>) {\n@@ -3083,7 +3083,7 @@ sub update\n \n         if ( defined ( $lastpicked ) )\n         {\n-            my $filepipe = open(FILELIST, '-|', 'git-diff-tree', '-z', '-r', $lastpicked, $commit->{hash}) or die(\"Cannot call git-diff-tree : $!\");\n+            my $filepipe = open(FILELIST, '-|', 'git', 'diff-tree', '-z', '-r', $lastpicked, $commit->{hash}) or die(\"Cannot call git-diff-tree : $!\");\n \t    local ($/) = \"\\0\";\n             while ( <FILELIST> )\n             {\n@@ -3157,7 +3157,7 @@ sub update\n             # this is used to detect files removed from the repo\n             my $seen_files = {};\n \n-            my $filepipe = open(FILELIST, '-|', 'git-ls-tree', '-z', '-r', $commit->{hash}) or die(\"Cannot call git-ls-tree : $!\");\n+            my $filepipe = open(FILELIST, '-|', 'git', 'ls-tree', '-z', '-r', $commit->{hash}) or die(\"Cannot call git-ls-tree : $!\");\n \t    local $/ = \"\\0\";\n             while ( <FILELIST> )\n             {\n@@ -3448,7 +3448,7 @@ sub commitmessage\n         return $message;\n     }\n \n-    my @lines = safe_pipe_capture(\"git-cat-file\", \"commit\", $commithash);\n+    my @lines = safe_pipe_capture(\"git\", \"cat-file\", \"commit\", $commithash);\n     shift @lines while ( $lines[0] =~ /\\S/ );\n     $message = join(\"\",@lines);\n     $message .= \" \" if ( $message =~ /\\n$/ );\n-- \n1.6.1.81.g9833d.dirty\n"},{"id":"101794","messageId":"1232840601-24696-7-git-send-email-mmogilvi_git@miniinfo.net","threadId":"17345","inReplyTo":"1232840601-24696-6-git-send-email-mmogilvi_git@miniinfo.net","subject":"[PATCH 06/10] t2300: use documented technique to invoke git-sh-setup","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-01-24T23:43:17Z","receivedAt":"2009-01-24T23:43:17Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"This is needed to allow the test suite to run against a minimal bin\ndirectory instead of GIT_EXEC_PATH.\n\nSigned-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>\n---\n t/t2300-cd-to-toplevel.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t2300-cd-to-toplevel.sh b/t/t2300-cd-to-toplevel.sh\nindex e42cbfe..eac348a 100755\n--- a/t/t2300-cd-to-toplevel.sh\n+++ b/t/t2300-cd-to-toplevel.sh\n@@ -8,7 +8,7 @@ test_cd_to_toplevel () {\n \ttest_expect_success \"$2\" '\n \t\t(\n \t\t\tcd '\"'$1'\"' &&\n-\t\t\t. git-sh-setup &&\n+\t\t\t. \"$(git --exec-path)\"/git-sh-setup &&\n \t\t\tcd_to_toplevel &&\n \t\t\t[ \"$(unset PWD; /bin/pwd)\" = \"$TOPLEVEL\" ]\n \t\t)\n-- \n1.6.1.81.g9833d.dirty\n"},{"id":"101796","messageId":"1232840601-24696-8-git-send-email-mmogilvi_git@miniinfo.net","threadId":"17345","inReplyTo":"1232840601-24696-7-git-send-email-mmogilvi_git@miniinfo.net","subject":"[PATCH 07/10] t3409: use dashless \"git commit\" instead of \"git-commit\"","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-01-24T23:43:18Z","receivedAt":"2009-01-24T23:43:18Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"This is needed to allow test suite to run against a minimal bin\ndirectory instead of GIT_EXEC_PATH.\n\nSigned-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>\n---\n\nSemi-related:\n\nI noticed that there are actually two test cases numbered\nt3409: t3409-rebase-hook.sh and t3409-rebase-preserve-merges.sh.\nShould one of them be renumbered, or is it good enough as-is?  I'm\njust pointing this out; I don't intend to change it myself.\n\n--\nMatthew Ogilvie   [mmogilvi_git@miniinfo.net]\n\n t/t3409-rebase-preserve-merges.sh |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t3409-rebase-preserve-merges.sh b/t/t3409-rebase-preserve-merges.sh\nindex e6c8327..8878771 100755\n--- a/t/t3409-rebase-preserve-merges.sh\n+++ b/t/t3409-rebase-preserve-merges.sh\n@@ -32,14 +32,14 @@ export GIT_AUTHOR_EMAIL\n test_expect_success 'setup for merge-preserving rebase' \\\n \t'echo First > A &&\n \tgit add A &&\n-\tgit-commit -m \"Add A1\" &&\n+\tgit commit -m \"Add A1\" &&\n \tgit checkout -b topic &&\n \techo Second > B &&\n \tgit add B &&\n-\tgit-commit -m \"Add B1\" &&\n+\tgit commit -m \"Add B1\" &&\n \tgit checkout -f master &&\n \techo Third >> A &&\n-\tgit-commit -a -m \"Modify A2\" &&\n+\tgit commit -a -m \"Modify A2\" &&\n \n \tgit clone ./. clone1 &&\n \tcd clone1 &&\n-- \n1.6.1.81.g9833d.dirty\n"},{"id":"101800","messageId":"1232840601-24696-9-git-send-email-mmogilvi_git@miniinfo.net","threadId":"17345","inReplyTo":"1232840601-24696-8-git-send-email-mmogilvi_git@miniinfo.net","subject":"[PATCH 08/10] run test suite without dashed git-commands in PATH","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-01-24T23:43:19Z","receivedAt":"2009-01-24T23:43:19Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"Exclude GIT_EXEC_PATH from PATH, to emulate the default user environment,\nand ensure all the programs (especially scripts) run correctly in\nsuch an environment.\n\nThis works by creating a test-bin directory with wrapper scripts for\nthe programs normally installed in \"bin\", and only including that\ndirectory in the PATH.\n\nSigned-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>\n---\n\nValgrind conflict:  As I was preparing this email, I noticed that a patch\nfor running the test suite under valgrind has been under discussion\nin the mailing list.  The valgrind patch probably conflicts with this\none.  I've thought of some possible ways to resolve it:\n\n   1. Extend this patch to support valgrind by adding\nenvironment-variable controlled hook to test-bin-wrapper.sh,\nand enhance the makefile rules to disable the valgrind hook\nfor instances of the script that are wrapping other scripts.\n(This allows dashless, valgrind, or both.)\n\n   2. Or change the valgrind patch to only add executables typically\nfound in bindir (not GIT_EXEC_PATH) to the symlink directory.  To\nsupport dashless by itself, it would need to do a similar symlink\nwhen asked for dashless without valgrind.\n\n   3. Or keep the core of both patches, and just fix up the setup\nin test-lib.sh to only enable one or the other (never both).\n\nThoughts?\n\n--\nMatthew Ogilvie   [mmogilvi_git@miniinfo.net]\n\n .gitignore          |    1 +\n Makefile            |   42 +++++++++++++++++++++++++++++++-----------\n t/test-lib.sh       |   14 +++++++++++++-\n test-bin-wrapper.sh |   12 ++++++++++++\n 4 files changed, 57 insertions(+), 12 deletions(-)\n create mode 100644 test-bin-wrapper.sh\n\ndiff --git a/.gitignore b/.gitignore\nindex d9adce5..13a0d33 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -143,6 +143,7 @@ git-write-tree\n git-core-*/?*\n gitk-wish\n gitweb/gitweb.cgi\n+test-bin\n test-chmtime\n test-date\n test-delta\ndiff --git a/Makefile b/Makefile\nindex b4d9cb4..197a6f0 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -330,6 +330,15 @@ ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)\n # what 'all' will build but not install in gitexecdir\n OTHER_PROGRAMS = git$X gitweb/gitweb.cgi\n \n+# what test wrappers are needed and 'install' will install, in bindir\n+BINDIR_PROGRAMS_NEED_X += git\n+BINDIR_PROGRAMS_NEED_X += git-upload-pack\n+BINDIR_PROGRAMS_NEED_X += git-receive-pack\n+BINDIR_PROGRAMS_NEED_X += git-upload-archive\n+BINDIR_PROGRAMS_NEED_X += git-shell\n+\n+BINDIR_PROGRAMS_NO_X += git-cvsserver\n+\n # Set paths to tools early so that they can be used for version tests.\n ifndef SHELL_PATH\n \tSHELL_PATH = /bin/sh\n@@ -1356,17 +1365,25 @@ endif\n \n ### Testing rules\n \n-TEST_PROGRAMS += test-chmtime$X\n-TEST_PROGRAMS += test-ctype$X\n-TEST_PROGRAMS += test-date$X\n-TEST_PROGRAMS += test-delta$X\n-TEST_PROGRAMS += test-genrandom$X\n-TEST_PROGRAMS += test-match-trees$X\n-TEST_PROGRAMS += test-parse-options$X\n-TEST_PROGRAMS += test-path-utils$X\n-TEST_PROGRAMS += test-sha1$X\n+TEST_PROGRAMS_NEED_X += test-chmtime\n+TEST_PROGRAMS_NEED_X += test-ctype\n+TEST_PROGRAMS_NEED_X += test-date\n+TEST_PROGRAMS_NEED_X += test-delta\n+TEST_PROGRAMS_NEED_X += test-genrandom\n+TEST_PROGRAMS_NEED_X += test-match-trees\n+TEST_PROGRAMS_NEED_X += test-parse-options\n+TEST_PROGRAMS_NEED_X += test-path-utils\n+TEST_PROGRAMS_NEED_X += test-sha1\n+\n+TEST_PROGRAMS = $(patsubst %,%$X,$(TEST_PROGRAMS_NEED_X))\n \n-all:: $(TEST_PROGRAMS)\n+test_bindir_programs := $(patsubst %,test-bin/%,$(BINDIR_PROGRAMS_NEED_X) $(BINDIR_PROGRAMS_NO_X) $(TEST_PROGRAMS_NEED_X))\n+\n+all:: $(TEST_PROGRAMS) $(test_bindir_programs)\n+\n+test-bin/%: test-bin-wrapper.sh\n+\t@mkdir -p test-bin\n+\t$(QUIET_GEN)sed -e 's|__GIT_EXEC_PATH__|$(shell pwd)|' -e 's|__PROG__|$(@F)|' < $< > $@ && chmod +x $@\n \n # GNU make supports exporting all variables by \"export\" without parameters.\n # However, the environment gets quite big, and some programs have problems\n@@ -1425,11 +1442,13 @@ endif\n gitexec_instdir_SQ = $(subst ','\\'',$(gitexec_instdir))\n export gitexec_instdir\n \n+install_bindir_programs := $(patsubst %,%$X,$(BINDIR_PROGRAMS_NEED_X)) $(BINDIR_PROGRAMS_NO_X)\n+\n install: all\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'\n \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n \t$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)'\n-\t$(INSTALL) git$X git-upload-pack$X git-receive-pack$X git-upload-archive$X git-shell$X git-cvsserver '$(DESTDIR_SQ)$(bindir_SQ)'\n+\t$(INSTALL) $(install_bindir_programs) '$(DESTDIR_SQ)$(bindir_SQ)'\n \t$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install\n \t$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install\n ifndef NO_TCLTK\n@@ -1533,6 +1552,7 @@ clean:\n \t\t$(LIB_FILE) $(XDIFF_LIB)\n \t$(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X\n \t$(RM) $(TEST_PROGRAMS)\n+\t$(RM) -r test-bin\n \t$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*\n \t$(RM) -r autom4te.cache\n \t$(RM) config.log config.mak.autogen config.mak.append config.status config.cache\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 41d5a59..2f42b5b 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -89,6 +89,8 @@ do\n \t\tverbose=t; shift ;;\n \t-q|--q|--qu|--qui|--quie|--quiet)\n \t\tquiet=t; shift ;;\n+\t--with-dashes)\n+\t\twith_dashes=t; shift ;;\n \t--no-color)\n \t\tcolor=; shift ;;\n \t--no-python)\n@@ -467,8 +469,18 @@ test_done () {\n # Test the binaries we have just built.  The tests are kept in\n # t/ subdirectory and are run in 'trash directory' subdirectory.\n TEST_DIRECTORY=$(pwd)\n-PATH=$TEST_DIRECTORY/..:$PATH\n GIT_EXEC_PATH=$(pwd)/..\n+git_bin_dir=\"$TEST_DIRECTORY/../test-bin\"\n+if ! test -x \"$git_bin_dir/git\" ; then\n+\tif test -z \"$with_dashes\" ; then\n+\t\tsay \"$git_bin_dir/git is not executable; using GIT_EXEC_PATH\"\n+\tfi\n+\twith_dashes=t\n+fi\n+PATH=\"$git_bin_dir:$PATH\"\n+if test -n \"$with_dashes\" ; then\n+\tPATH=\"$TEST_DIRECTORY/..:$PATH\"\n+fi\n GIT_TEMPLATE_DIR=$(pwd)/../templates/blt\n unset GIT_CONFIG\n GIT_CONFIG_NOSYSTEM=1\ndiff --git a/test-bin-wrapper.sh b/test-bin-wrapper.sh\nnew file mode 100644\nindex 0000000..199d098\n--- /dev/null\n+++ b/test-bin-wrapper.sh\n@@ -0,0 +1,12 @@\n+#!/bin/sh\n+\n+# test-bin-wrapper.sh: Template for git executable wrapper scripts\n+# to run test suite against sandbox, but with only bindir-installed\n+# executables in PATH.  The Makefile copies this into various\n+# files in test-bin, substituting __GIT_EXEC_PATH__ and __PROG__.\n+\n+GIT_EXEC_PATH=\"__GIT_EXEC_PATH__\"\n+GIT_TEMPLATE_DIR=\"__GIT_EXEC_PATH__/templates/blt\"\n+export GIT_EXEC_PATH GIT_TEMPLATE_DIR\n+\n+exec \"${GIT_EXEC_PATH}/__PROG__\" \"$@\"\n-- \n1.6.1.81.g9833d.dirty\n"},{"id":"101799","messageId":"1232840601-24696-10-git-send-email-mmogilvi_git@miniinfo.net","threadId":"17345","inReplyTo":"1232840601-24696-9-git-send-email-mmogilvi_git@miniinfo.net","subject":"[PATCH 09/10] Revert \"adapt git-cvsserver manpage to dash-free syntax\"","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-01-24T23:43:20Z","receivedAt":"2009-01-24T23:43:20Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"This reverts commit da9973c6f9600d90e64aac647f3ed22dfd692f70,\nand a couple of other remaining references to \"git cvsserver\".\n\nWhen da9973c6f9600 was committed, we did not install git-cvsserver\nin $(bindir) by default, but that situation did not last long (see\n1df2a1ce806 \"Install git-cvsserver in $(bindir)\").  Also, a recent\ncommit (cvsserver: use dashless \"git command\"s to access plumbing)\nfixed an issue with git-cvsserver trying to run dashed forms\nwithout setting up the PATH for it.\n\nThe dashed form is arguably better in this case, since it is\nrequired for cvs's \":fork:\" connection method (although \":ext:\"\nusually doesn't need dashes), and it can minimize the need to escape\ncharacters when setting up CVS_SERVER and/or CVSROOT.\n\nSigned-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>\n---\n\nNote: It might conceivably be worth holding off on this patch for a\nrelease, in case someone tries to use a newer man page from the web with\nan older install of git, where git-cvsserver still has the PATH bug\nmentioned in the commit message above.  But I doubt this is really\ncommon enough to worry about.\n\n--\nMatthew Ogilvie   [mmogilvi_git@miniinfo.net]\n\n Documentation/git-cvsserver.txt |   10 +++++-----\n git-cvsserver.perl              |    2 +-\n 2 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt\nindex e32ad7b..6f8cd88 100644\n--- a/Documentation/git-cvsserver.txt\n+++ b/Documentation/git-cvsserver.txt\n@@ -11,7 +11,7 @@ SYNOPSIS\n SSH:\n \n [verse]\n-export CVS_SERVER=\"git cvsserver\"\n+export CVS_SERVER=git-cvsserver\n 'cvs' -d :ext:user@server/path/repo.git co <HEAD_name>\n \n pserver (/etc/inetd.conf):\n@@ -22,7 +22,7 @@ cvspserver stream tcp nowait nobody /usr/bin/git-cvsserver git-cvsserver pserver\n Usage:\n \n [verse]\n-'git cvsserver' [options] [pserver|server] [<directory> ...]\n+'git-cvsserver' [options] [pserver|server] [<directory> ...]\n \n OPTIONS\n -------\n@@ -109,7 +109,7 @@ Note: Newer CVS versions (>= 1.12.11) also support specifying\n CVS_SERVER directly in CVSROOT like\n \n ------\n-cvs -d \":ext;CVS_SERVER=git cvsserver:user@server/path/repo.git\" co <HEAD_name>\n+cvs -d \":ext;CVS_SERVER=git-cvsserver:user@server/path/repo.git\" co <HEAD_name>\n ------\n This has the advantage that it will be saved in your 'CVS/Root' files and\n you don't need to worry about always setting the correct environment\n@@ -161,7 +161,7 @@ allowing access over SSH.\n --\n ------\n      export CVSROOT=:ext:user@server:/var/git/project.git\n-     export CVS_SERVER=\"git cvsserver\"\n+     export CVS_SERVER=git-cvsserver\n ------\n --\n 4. For SSH clients that will make commits, make sure their server-side\n@@ -286,7 +286,7 @@ To get a checkout with the Eclipse CVS client:\n Protocol notes: If you are using anonymous access via pserver, just select that.\n Those using SSH access should choose the 'ext' protocol, and configure 'ext'\n access on the Preferences->Team->CVS->ExtConnection pane. Set CVS_SERVER to\n-\"'git cvsserver'\". Note that password support is not good when using 'ext',\n+'git-cvsserver'. Note that password support is not good when using 'ext',\n you will definitely want to have SSH keys setup.\n \n Alternatively, you can just use the non-standard extssh protocol that Eclipse\ndiff --git a/git-cvsserver.perl b/git-cvsserver.perl\nindex 8e9e659..4b817ce 100755\n--- a/git-cvsserver.perl\n+++ b/git-cvsserver.perl\n@@ -100,7 +100,7 @@ my $work =\n $log->info(\"--------------- STARTING -----------------\");\n \n my $usage =\n-    \"Usage: git cvsserver [options] [pserver|server] [<directory> ...]\\n\".\n+    \"Usage: git-cvsserver [options] [pserver|server] [<directory> ...]\\n\".\n     \"    --base-path <path>  : Prepend to requested CVSROOT\\n\".\n     \"    --strict-paths      : Don't allow recursing into subdirectories\\n\".\n     \"    --export-all        : Don't check for gitcvs.enabled in config\\n\".\n-- \n1.6.1.81.g9833d.dirty\n"},{"id":"101797","messageId":"1232840601-24696-11-git-send-email-mmogilvi_git@miniinfo.net","threadId":"17345","inReplyTo":"1232840601-24696-10-git-send-email-mmogilvi_git@miniinfo.net","subject":"[PATCH 10/10] cvsserver doc: emphasize using CVS_SERVER= phrase within CVSROOT","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-01-24T23:43:21Z","receivedAt":"2009-01-24T23:43:21Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"Add information about CVSROOT=\":ext;CVS_SERVER=git-cvsserver:...\" to\n\"SYNOPSIS\" section.  This information was/is already spelled out deep in\nthe \"INSTALLATION\" section, but this new method is far superior to\nthe old backwards-compatible option (separate environment variable),\nso try to emphasize it's use for versions of CVS that support it.\n\nAlso mention how to connect to a local git repository using\ngit-cvsserver.\n\nSigned-off-by: Matthew Ogilvie <mmogilvi_git@miniinfo.net>\n---\n Documentation/git-cvsserver.txt |   12 ++++++++++++\n 1 files changed, 12 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-cvsserver.txt b/Documentation/git-cvsserver.txt\nindex 6f8cd88..d1dc5be 100644\n--- a/Documentation/git-cvsserver.txt\n+++ b/Documentation/git-cvsserver.txt\n@@ -14,6 +14,18 @@ SSH:\n export CVS_SERVER=git-cvsserver\n 'cvs' -d :ext:user@server/path/repo.git co <HEAD_name>\n \n+SSH with newer CVS versions (>= 1.12.11):\n+\n+[verse]\n+export CVSROOT=\":ext;CVS_SERVER=git-cvsserver:user@server/path/repo.git\"\n+'cvs' -d \"$CVSROOT\" co <HEAD_name>\n+\n+Local repository:\n+\n+[verse]\n+export CVSROOT=\":fork;CVS_SERVER=git-cvsserver:/path/repo.git\"\n+'cvs' -d \"$CVSROOT\" co <HEAD_name>\n+\n pserver (/etc/inetd.conf):\n \n [verse]\n-- \n1.6.1.81.g9833d.dirty\n"},{"id":"101807","messageId":"alpine.DEB.1.00.0901250252400.14855@racer","threadId":"17345","inReplyTo":"1232840601-24696-5-git-send-email-mmogilvi_git@miniinfo.net","subject":"Re: [PATCH 04/10] git-shell: allow running git-cvsserver, not just cvs","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-25T01:53:19Z","receivedAt":"2009-01-25T01:53:19Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 24 Jan 2009, Matthew Ogilvie wrote:\n\n> diff --git a/shell.c b/shell.c\n> index e339369..6ed960f 100644\n> --- a/shell.c\n> +++ b/shell.c\n> @@ -40,6 +40,7 @@ static struct commands {\n>  } cmd_list[] = {\n>  \t{ \"git-receive-pack\", do_generic_cmd },\n>  \t{ \"git-upload-pack\", do_generic_cmd },\n> +\t{ \"git-cvsserver\", do_cvs_cmd },\n>  \t{ \"cvs\", do_cvs_cmd },\n>  \t{ NULL },\n>  };\n\nI do not see any value in this.\n\nCiao,\nDscho\n"},{"id":"101808","messageId":"alpine.DEB.1.00.0901250255250.14855@racer","threadId":"17345","inReplyTo":"1232840601-24696-9-git-send-email-mmogilvi_git@miniinfo.net","subject":"Re: [PATCH 08/10] run test suite without dashed git-commands in PATH","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-25T01:59:53Z","receivedAt":"2009-01-25T01:59:53Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 24 Jan 2009, Matthew Ogilvie wrote:\n\n>  .gitignore          |    1 +\n>  Makefile            |   42 +++++++++++++++++++++++++++++++-----------\n>  t/test-lib.sh       |   14 +++++++++++++-\n>  test-bin-wrapper.sh |   12 ++++++++++++\n>  4 files changed, 57 insertions(+), 12 deletions(-)\n>  create mode 100644 test-bin-wrapper.sh\n\nI am strongly opposed to a patch this big, just for something as 3rd class \nas CVS server faking.  We already have a big fallout from all that bending \nover for Windows support, and I do not like it at all.\n\nNote: I do not even have to look further than the diffstat to see that it \nis wrong.\n\nThe point is: if cvsserver wants to pretend that it is in a fake bin where \nalmost none of the other Git programs are, fine, let's do that _in the \ntest for cvsserver_.\n\nLet's not fsck up the whole test suite just for one user.\n\nCiao,\nDscho\n"},{"id":"101946","messageId":"20090126064004.GA3004@comcast.net","threadId":"17345","inReplyTo":"alpine.DEB.1.00.0901250255250.14855@racer","subject":"Re: [PATCH 08/10] run test suite without dashed git-commands in PATH","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-01-26T06:40:04Z","receivedAt":"2009-01-26T06:40:04Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"Hi,\n\nOn Sun, Jan 25, 2009 at 02:59:53AM +0100, Johannes Schindelin wrote:\n> Hi,\n> \n> On Sat, 24 Jan 2009, Matthew Ogilvie wrote:\n> \n> >  .gitignore          |    1 +\n> >  Makefile            |   42 +++++++++++++++++++++++++++++++-----------\n> >  t/test-lib.sh       |   14 +++++++++++++-\n> >  test-bin-wrapper.sh |   12 ++++++++++++\n> >  4 files changed, 57 insertions(+), 12 deletions(-)\n> >  create mode 100644 test-bin-wrapper.sh\n> \n> I am strongly opposed to a patch this big, just for something as 3rd class \n> as CVS server faking.  We already have a big fallout from all that bending \n> over for Windows support, and I do not like it at all.\n> \n> Note: I do not even have to look further than the diffstat to see that it \n> is wrong.\n> \n> The point is: if cvsserver wants to pretend that it is in a fake bin where \n> almost none of the other Git programs are, fine, let's do that _in the \n> test for cvsserver_.\n> \n> Let's not fsck up the whole test suite just for one user.\n> \n> Ciao,\n> Dscho\n\nSince by default git is installed such that most of the dashed-form\ncommands are not in a user's default PATH, my thought was that\nit would make sense for the test suite to mimick that environment\nas much as possible.  This could detect regressions in any\ninstalled/tested git script that erroneously assumes the dashed\nform commands are in the PATH, not just git-cvsserver.\n\nI can think of ways it could be made smaller, but they seem uglier than\nthe current patch to me:\n\n    1. Perhaps just list the executables for the fake bin directory\nseparately, but then it is all too easy for the list to get out of sync\nwith what the final install environment will be.\n\n    2. Perhaps strip off the $X's (.exe on windows; currently empty\nelsewhere) from the words of the existing variables, in the rule\nfor building the \"fake bin\" directory.  But generally I'ld rather\nnot assume that pattern-matching replacement of\n$X's will never conflict with a part of a script name.\n\n    3. Perhaps just use symlinks or hardlinks instead of a wrapper\nscript.  This might have some promise, except that links are more\nlikely to fail on windows, and the wrappers generally give you\nmore flexibility for testing odd scenarios.\n\n    4. The test-bin-wrapper.sh script does not actually need to\nset environment variables (GIT_EXEC_DIT and templates) for\npurposes of this patch.  But my thought was that in this form\nyou could run things straight out of the test-bin directory\nto manually try out new code without needing to actually install\na build or mess with the environment variables yourself.  It could\nalso be extended to handle other global wrapper needs\nrelatively easily, such as valgrind.\n\nAny other ideas?\n\n--\nMatthew Ogilvie   [mmogilvi_git@miniinfo.net]\n"},{"id":"101961","messageId":"alpine.DEB.1.00.0901261201470.14855@racer","threadId":"17345","inReplyTo":"20090126064004.GA3004@comcast.net","subject":"Re: [PATCH 08/10] run test suite without dashed git-commands in PATH","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-26T11:06:08Z","receivedAt":"2009-01-26T11:06:08Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 25 Jan 2009, Matthew Ogilvie wrote:\n\n> On Sun, Jan 25, 2009 at 02:59:53AM +0100, Johannes Schindelin wrote:\n> \n> > On Sat, 24 Jan 2009, Matthew Ogilvie wrote:\n> > \n> > >  .gitignore          |    1 +\n> > >  Makefile            |   42 +++++++++++++++++++++++++++++++-----------\n> > >  t/test-lib.sh       |   14 +++++++++++++-\n> > >  test-bin-wrapper.sh |   12 ++++++++++++\n> > >  4 files changed, 57 insertions(+), 12 deletions(-)\n> > >  create mode 100644 test-bin-wrapper.sh\n> > \n> > I am strongly opposed to a patch this big, just for something as 3rd \n> > class as CVS server faking.  We already have a big fallout from all \n> > that bending over for Windows support, and I do not like it at all.\n> > \n> > Note: I do not even have to look further than the diffstat to see that \n> > it is wrong.\n> > \n> > The point is: if cvsserver wants to pretend that it is in a fake bin \n> > where almost none of the other Git programs are, fine, let's do that \n> > _in the test for cvsserver_.\n> \n> Since by default git is installed such that most of the dashed-form \n> commands are not in a user's default PATH, my thought was that it would \n> make sense for the test suite to mimick that environment as much as \n> possible.\n\nThis sounds very generic, but you hid it in cvsserver-specific patch \nseries.\n\nSo maybe I was wrong to assume that this is cvsserver specific, but then, \nyou made that mistake rather easy to make.\n\n> This could detect regressions in any installed/tested git script that \n> erroneously assumes the dashed form commands are in the PATH, not just \n> git-cvsserver.\n\nThe major point is that these scripts _will_ run if you call _them_ using \nthe dash-less form, as GIT_EXEC_PATH will be added to the PATH by the Git \nwrapper.\n\n>     3. Perhaps just use symlinks or hardlinks instead of a wrapper \n>        script.  This might have some promise, except that links are more \n>        likely to fail on windows, and the wrappers generally give you \n>        more flexibility for testing odd scenarios.\n\nNot likely.  Sure as hell.\n\n>     4. The test-bin-wrapper.sh script does not actually need to set \n>        environment variables (GIT_EXEC_DIT and templates) for purposes \n>        of this patch.  But my thought was that in this form you could \n>        run things straight out of the test-bin directory to manually try \n>        out new code without needing to actually install a build or mess \n>        with the environment variables yourself.  It could also be \n>        extended to handle other global wrapper needs relatively easily, \n>        such as valgrind.\n\nUmm.\n\nYou missed the valgrind patch series.\n\nCiao,\nDscho\n"},{"id":"102087","messageId":"20090127061349.GA2417@comcast.net","threadId":"17345","inReplyTo":"alpine.DEB.1.00.0901261201470.14855@racer","subject":"Re: [PATCH 08/10] run test suite without dashed git-commands in PATH","fromName":"Matthew Ogilvie","fromEmail":"mmogilvi_git@miniinfo.net","sentAt":"2009-01-27T06:13:49Z","receivedAt":"2009-01-27T06:13:49Z","isPatch":true,"sender":{"key":"mmogilvi_git@miniinfo.net","avatar":null},"body":"On Mon, Jan 26, 2009 at 12:06:08PM +0100, Johannes Schindelin wrote:\n> So maybe I was wrong to assume that this is cvsserver specific, but then, \n> you made that mistake rather easy to make.\n\nYes, in retrospect I probably should have split off patches 6, 7,\n8, and maybe 5 (5-7 fix issues that patch 8 exposes in the test suite)\ninto a separate patch series.  When or if a v2 is needed, should\nI split them off then?\n\n> >     4. The test-bin-wrapper.sh script does not actually need to set \n> >        environment variables (GIT_EXEC_DIT and templates) for purposes \n> >        of this patch.  But my thought was that in this form you could \n> >        run things straight out of the test-bin directory to manually try \n> >        out new code without needing to actually install a build or mess \n> >        with the environment variables yourself.  It could also be \n> >        extended to handle other global wrapper needs relatively easily, \n> >        such as valgrind.\n> \n> Umm.\n> \n> You missed the valgrind patch series.\n\nActually, I'm (poorly) alluding to some comments in the original patch\n8 email, where I pointed out an expected conflict with the valgrind\npatches.  To briefly recap, there are at least 3 possible strategies\nof resolving such a conflict, and I'm not sure which makes the most\nsense: Keep valgrind design, and extend it with limited bindir\nsupport.  Keep limited bindir design and extend it with valgrind\nsupport.  Or keep both, and have the runtime setup logic make\nthem mutually exclusive.\n\n--\nMatthew Ogilvie   [mmogilvi_git@miniinfo.net]\n"}]}