{"thread":{"id":"4627","subject":"[PATCH] Git.pm: Implement Git::exec_path()","startedAt":"2006-06-22T22:31:50Z","lastAt":"2006-06-22T22:31:50Z","messageCount":1,"participants":["Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"22315","messageId":"20060622223150.21622.22126.stgit@machine.or.cz","threadId":"4627","inReplyTo":null,"subject":"[PATCH] Git.pm: Implement Git::exec_path()","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-06-22T22:31:50Z","receivedAt":"2006-06-22T22:31:50Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"This patch implements Git::exec_path() (as a direct XS call).\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n---\n\n perl/Git.pm |   20 +++++++++++++++++++-\n perl/Git.xs |   10 ++++++++++\n 2 files changed, 29 insertions(+), 1 deletions(-)\n\ndiff --git a/perl/Git.pm b/perl/Git.pm\nindex 4bb7c50..516c065 100644\n--- a/perl/Git.pm\n+++ b/perl/Git.pm\n@@ -47,7 +47,8 @@ require Exporter;\n @EXPORT = qw();\n \n # Methods which can be called as standalone functions as well:\n-@EXPORT_OK = qw(command command_oneline command_pipe command_noisy);\n+@EXPORT_OK = qw(command command_oneline command_pipe command_noisy\n+                exec_path hash_object);\n \n \n =head1 DESCRIPTION\n@@ -213,6 +214,7 @@ sub command {\n \t}\n }\n \n+\n =item command_oneline ( COMMAND [, ARGUMENTS... ] )\n \n Execute the given C<COMMAND> in the same way as command()\n@@ -231,6 +233,7 @@ sub command_oneline {\n \treturn $line;\n }\n \n+\n =item command_pipe ( COMMAND [, ARGUMENTS... ] )\n \n Execute the given C<COMMAND> in the same way as command()\n@@ -253,6 +256,7 @@ sub command_pipe {\n \treturn $fh;\n }\n \n+\n =item command_noisy ( COMMAND [, ARGUMENTS... ] )\n \n Execute the given C<COMMAND> in the same way as command() does but do not\n@@ -283,6 +287,20 @@ sub command_noisy {\n \t}\n }\n \n+\n+=item exec_path ()\n+\n+Return path to the git sub-command executables (the same as\n+C<git --exec-path>). Useful mostly only internally.\n+\n+Implementation of this function is very fast; no external command calls\n+are involved.\n+\n+=cut\n+\n+# Implemented in Git.xs.\n+\n+\n =item hash_object ( FILENAME [, TYPE ] )\n \n =item hash_object ( FILEHANDLE [, TYPE ] )\ndiff --git a/perl/Git.xs b/perl/Git.xs\nindex 33bb3ca..d1f94a4 100644\n--- a/perl/Git.xs\n+++ b/perl/Git.xs\n@@ -6,6 +6,7 @@ #include <ctype.h>\n \n /* libgit interface */\n #include \"../cache.h\"\n+#include \"../exec_cmd.h\"\n \n /* XS and Perl interface */\n #include \"EXTERN.h\"\n@@ -19,6 +20,15 @@ MODULE = Git\t\tPACKAGE = Git\t\t\n \n # /* TODO: xs_call_gate(). See Git.pm. */\n \n+\n+const char *\n+xs_exec_path()\n+CODE:\n+\tRETVAL = git_exec_path();\n+OUTPUT:\n+\tRETVAL\n+\n+\n char *\n xs_hash_object(file, type = \"blob\")\n \tSV *file;\n"}]}