summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: eca1f6f)
raw | patch | inline | side by side (parent: eca1f6f)
author | Petr Baudis <pasky@suse.cz> | |
Sat, 24 Jun 2006 02:34:34 +0000 (04:34 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 3 Jul 2006 00:14:40 +0000 (17:14 -0700) |
Instead of explicitly using the git wrapper to call external commands,
use the execv_git_cmd() function which will directly call whatever
needs to be called. GitBin option becomes useless so drop it.
This actually means the exec_path() thing I planned to use worthless
internally, but Jakub wants it in anyway and I don't mind, so...
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
use the execv_git_cmd() function which will directly call whatever
needs to be called. GitBin option becomes useless so drop it.
This actually means the exec_path() thing I planned to use worthless
internally, but Jakub wants it in anyway and I don't mind, so...
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
perl/Git.pm | patch | blob | history | |
perl/Git.xs | patch | blob | history |
diff --git a/perl/Git.pm b/perl/Git.pm
index 5c5ae1246b717ad1bf6217254175111d4cc8b45a..212337ee5bfe64bb0479eab01beb073f4f007f89 100644 (file)
--- a/perl/Git.pm
+++ b/perl/Git.pm
If the directory does not have the subdirectory, C<WorkingCopy> is left
undefined and C<Repository> is pointed to the directory itself.
-B<GitPath> - Path to the C<git> binary executable. By default the C<$PATH>
-is searched for it.
-
You should not use both C<Directory> and either of C<Repository> and
C<WorkingCopy> - the results of that are undefined.
$self->{opts}->{Repository} and $ENV{'GIT_DIR'} = $self->{opts}->{Repository};
$self->{opts}->{WorkingCopy} and chdir($self->{opts}->{WorkingCopy});
}
- my $git = $self->{opts}->{GitPath};
- $git ||= 'git';
- exec ($git, @args) or croak "exec failed: $!";
+ xs__execv_git_cmd(@args);
+ croak "exec failed: $!";
}
+# Execute the given Git command ($_[0]) with arguments ($_[1..])
+# by searching for it at proper places.
+# _execv_git_cmd(), implemented in Git.xs.
+
# Close pipe to a subprocess.
sub _cmd_close {
my ($fh) = @_;
diff --git a/perl/Git.xs b/perl/Git.xs
index 9e754d25385f80dd402c61ea9c05e00cc5aa8b74..6478f9c77f4ead953c0f1fdbf9d9c41732529215 100644 (file)
--- a/perl/Git.xs
+++ b/perl/Git.xs
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(file, type = "blob")
SV *file;