diff options
author | Petr Baudis <pasky@suse.cz> | 2006-09-23 20:20:47 +0200 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-09-23 14:02:40 -0700 |
commit | 18b0fc1ce1ef92716d4c5d5c7acd5d5a61a0a556 (patch) | |
tree | edbda9f5f6b37cd63d5c216ee0ad3aebce85c0e8 /perl/Git.xs | |
parent | 81a71734bb73c2def1e86de88fb8de9fb6379cc5 (diff) | |
download | git-18b0fc1ce1ef92716d4c5d5c7acd5d5a61a0a556.tar.gz git-18b0fc1ce1ef92716d4c5d5c7acd5d5a61a0a556.tar.xz |
Git.pm: Kill Git.xs for now
This patch removes Git.xs from the repository for the time being. This
should hopefully enable Git.pm to finally make its way to master.
Git.xs is not going away forever. When the Git libification makes some
progress, it will hopefully return (but most likely as an optional
component, due to the portability woes) since the performance boosts are
really important for applications like Gitweb or Cogito. It needs to go
away now since it is not really reliable in case you use it for several
repositories in the scope of a single process, and that is not possible
to fix without some either very ugly or very intrusive core changes.
Rest in peace. (While you can.)
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'perl/Git.xs')
-rw-r--r-- | perl/Git.xs | 134 |
1 files changed, 0 insertions, 134 deletions
diff --git a/perl/Git.xs b/perl/Git.xs deleted file mode 100644 index 2bbec4365..000000000 --- a/perl/Git.xs +++ /dev/null @@ -1,134 +0,0 @@ -/* By carefully stacking #includes here (even if WE don't really need them) - * we strive to make the thing actually compile. Git header files aren't very - * nice. Perl headers are one of the signs of the coming apocalypse. */ -#include <ctype.h> -/* Ok, it hasn't been so bad so far. */ - -/* libgit interface */ -#include "../cache.h" -#include "../exec_cmd.h" - -/* XS and Perl interface */ -#include "EXTERN.h" -#include "perl.h" -#include "XSUB.h" - - -static char * -report_xs(const char *prefix, const char *err, va_list params) -{ - static char buf[4096]; - strcpy(buf, prefix); - vsnprintf(buf + strlen(prefix), 4096 - strlen(prefix), err, params); - return buf; -} - -static void NORETURN -die_xs(const char *err, va_list params) -{ - char *str; - str = report_xs("fatal: ", err, params); - croak(str); -} - -static void -error_xs(const char *err, va_list params) -{ - char *str; - str = report_xs("error: ", err, params); - warn(str); -} - - -MODULE = Git PACKAGE = Git - -PROTOTYPES: DISABLE - - -BOOT: -{ - set_error_routine(error_xs); - set_die_routine(die_xs); -} - - -# /* TODO: xs_call_gate(). See Git.pm. */ - - -char * -xs_version() -CODE: -{ - RETVAL = GIT_VERSION; -} -OUTPUT: - RETVAL - - -char * -xs_exec_path() -CODE: -{ - RETVAL = (char *)git_exec_path(); -} -OUTPUT: - RETVAL - - -void -xs__execv_git_cmd(...) -CODE: -{ - const char **argv; - int i; - - argv = malloc(sizeof(const char *) * (items + 1)); - if (!argv) - croak("malloc failed"); - for (i = 0; i < items; i++) - argv[i] = strdup(SvPV_nolen(ST(i))); - argv[i] = NULL; - - execv_git_cmd(argv); - - for (i = 0; i < items; i++) - if (argv[i]) - free((char *) argv[i]); - free((char **) argv); -} - -char * -xs_hash_object_pipe(type, fd) - char *type; - int fd; -CODE: -{ - unsigned char sha1[20]; - - if (index_pipe(sha1, fd, type, 0)) - croak("Unable to hash given filehandle"); - RETVAL = sha1_to_hex(sha1); -} -OUTPUT: - RETVAL - -char * -xs_hash_object_file(type, path) - char *type; - char *path; -CODE: -{ - unsigned char sha1[20]; - int fd = open(path, O_RDONLY); - struct stat st; - - if (fd < 0 || - fstat(fd, &st) < 0 || - index_fd(sha1, fd, &st, 0, type)) - croak("Unable to hash %s", path); - close(fd); - - RETVAL = sha1_to_hex(sha1); -} -OUTPUT: - RETVAL |