@matheusbsbs / matheus-bagliano / commits / eca1f6fdb8
Fork 0

Git.pm: Implement Git::exec_path()

This patch implements Git::exec_path() (as a direct XS call). Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>

Petr Baudis committed Jun 24, 2006 at 04:34 UTC eca1f6fdb862e6ca07288ac385725c95fd96490e
2 files changed +26 -1
perl/Git.pm
+14 -1
@@ -48,7 +48,7 @@ require Exporter;
48
49 # Methods which can be called as standalone functions as well:
50 @EXPORT_OK = qw(command command_oneline command_pipe command_noisy
51 - hash_object);
51 + exec_path hash_object);
52
53
54 =head1 DESCRIPTION
@@ -288,6 +288,19 @@ sub command_noisy {
288 }
289
290
291 +=item exec_path ()
292 +
293 +Return path to the git sub-command executables (the same as
294 +C<git --exec-path>). Useful mostly only internally.
295 +
296 +Implementation of this function is very fast; no external command calls
297 +are involved.
298 +
299 +=cut
300 +
301 +# Implemented in Git.xs.
302 +
303 +
304 =item hash_object ( FILENAME [, TYPE ] )
305
306 =item hash_object ( FILEHANDLE [, TYPE ] )
perl/Git.xs
+12
@@ -6,6 +6,7 @@
6
7 /* libgit interface */
8 #include "../cache.h"
9 +#include "../exec_cmd.h"
10
11 /* XS and Perl interface */
12 #include "EXTERN.h"
@@ -21,6 +22,17 @@ PROTOTYPES: DISABLE
22
23 # /* TODO: xs_call_gate(). See Git.pm. */
24
25 +
26 +const char *
27 +xs_exec_path()
28 +CODE:
29 +{
30 + RETVAL = git_exec_path();
31 +}
32 +OUTPUT:
33 + RETVAL
34 +
35 +
36 char *
37 xs_hash_object(file, type = "blob")
38 SV *file;