1 /* By carefully stacking #includes here (even if WE don't really need them)
2 * we strive to make the thing actually compile. Git header files aren't very
3 * nice. Perl headers are one of the signs of the coming apocalypse. */
5 /* Ok, it hasn't been so bad so far. */
9 #include "../exec_cmd.h"
11 /* XS and Perl interface */
19 MODULE = Git PACKAGE = Git
23 # /* TODO: xs_call_gate(). See Git.pm. */
30 RETVAL = git_exec_path();
37 xs__execv_git_cmd(...)
43 argv = malloc(sizeof(const char *) * (items + 1));
45 croak("malloc failed");
46 for (i = 0; i < items; i++)
47 argv[i] = strdup(SvPV_nolen(ST(i)));
52 for (i = 0; i < items; i++)
54 free((char *) argv[i]);
59 xs_hash_object(file, type = "blob")
64 unsigned char sha1[20];
66 if (SvTYPE(file) == SVt_RV)
69 if (SvTYPE(file) == SVt_PVGV) {
73 pio = IoIFP(sv_2io(file));
75 croak("You passed me something weird - a dir glob?");
76 /* XXX: I just hope PerlIO didn't read anything from it yet.
78 if (index_pipe(sha1, PerlIO_fileno(pio), type, 0))
79 croak("Unable to hash given filehandle");
80 /* Avoid any nasty surprises. */
85 char *path = SvPV_nolen(file);
86 int fd = open(path, O_RDONLY);
91 index_fd(sha1, fd, &st, 0, type))
92 croak("Unable to hash %s", path);
95 RETVAL = sha1_to_hex(sha1);