{"thread":{"id":"20820","subject":"[PATCH] git-cvsserver: no longer use deprecated 'git-subcommand' commands","startedAt":"2009-09-02T09:23:10Z","lastAt":"2009-09-02T09:23:10Z","messageCount":1,"participants":["Gerrit Pape"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"122303","messageId":"20090902092310.23525.qmail@2a30b353bc6194.315fe32.mid.smarden.org","threadId":"20820","inReplyTo":null,"subject":"[PATCH] git-cvsserver: no longer use deprecated 'git-subcommand' commands","fromName":"Gerrit Pape","fromEmail":"pape@smarden.org","sentAt":"2009-09-02T09:23:10Z","receivedAt":"2009-09-02T09:23:10Z","isPatch":true,"sender":{"key":"pape@smarden.org","avatar":"https://avatars.githubusercontent.com/u/143170252?v=4"},"body":"git-cvsserver still references git commands like 'git-config', which\nis depcrecated.  This commit changes git-cvsserver to use the\n'git subcommand' form.\n\nSylvain Beucler reported the problem through\n http://bugs.debian.org/536067\n\nSigned-off-by: Gerrit Pape <pape@smarden.org>\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 ab6cea3..6dc45f5 100755\n--- a/git-cvsserver.perl\n+++ b/git-cvsserver.perl\n@@ -285,7 +285,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@@ -702,7 +702,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@@ -1289,7 +1289,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@@ -1331,15 +1331,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@@ -1351,7 +1351,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@@ -1368,7 +1368,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@@ -1821,7 +1821,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@@ -1830,7 +1830,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@@ -1861,7 +1861,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@@ -2078,17 +2078,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@@ -2935,7 +2935,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@@ -3021,7 +3021,7 @@ sub update\n                         next;\n                     }\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@@ -3033,7 +3033,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@@ -3075,7 +3075,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@@ -3149,7 +3149,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@@ -3451,7 +3451,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.0.3\n"}]}