From 675df192c5fad6a2b35ea43d4017b01e275eddef Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 26 Aug 2020 12:46:49 -0700 Subject: transport-helper: do not run git-remote-ext etc. in dashed form Running it as "git remote-ext" and letting "git" dispatch to "remote-ext" would just be fine and is more idiomatic. Signed-off-by: Junio C Hamano diff --git a/transport-helper.c b/transport-helper.c index defafbf..c52c99d 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -128,10 +128,10 @@ static struct child_process *get_helper(struct transport *transport) helper->in = -1; helper->out = -1; helper->err = 0; - strvec_pushf(&helper->args, "git-remote-%s", data->name); + strvec_pushf(&helper->args, "remote-%s", data->name); strvec_push(&helper->args, transport->remote->name); strvec_push(&helper->args, remove_ext_force(transport->url)); - helper->git_cmd = 0; + helper->git_cmd = 1; helper->silent_exec_failure = 1; if (have_git_dir()) -- cgit v0.10.2-6-g49f6 From 7cff3b67aca11f757fb36ac58a89ae54bcb5b19e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 26 Aug 2020 12:46:50 -0700 Subject: cvsexportcommit: do not run git programs in dashed form This ancient script runs "git-foo" all over the place, which is OK for a scripted Porcelain in the Git suite, but asking "git" to dispatch to subcommands is the usual way these days. Signed-off-by: Junio C Hamano diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl index 0ae8bce..289d4bc 100755 --- a/git-cvsexportcommit.perl +++ b/git-cvsexportcommit.perl @@ -30,7 +30,7 @@ if ($opt_w || $opt_W) { # Remember where GIT_DIR is before changing to CVS checkout unless ($ENV{GIT_DIR}) { # No GIT_DIR set. Figure it out for ourselves - my $gd =`git-rev-parse --git-dir`; + my $gd =`git rev-parse --git-dir`; chomp($gd); $ENV{GIT_DIR} = $gd; } @@ -66,7 +66,7 @@ if ($opt_d) { # resolve target commit my $commit; $commit = pop @ARGV; -$commit = safe_pipe_capture('git-rev-parse', '--verify', "$commit^0"); +$commit = safe_pipe_capture('git', 'rev-parse', '--verify', "$commit^0"); chomp $commit; if ($?) { die "The commit reference $commit did not resolve!"; @@ -76,7 +76,7 @@ if ($?) { my $parent; if (@ARGV) { $parent = pop @ARGV; - $parent = safe_pipe_capture('git-rev-parse', '--verify', "$parent^0"); + $parent = safe_pipe_capture('git', 'rev-parse', '--verify', "$parent^0"); chomp $parent; if ($?) { die "The parent reference did not resolve!"; @@ -84,7 +84,7 @@ if (@ARGV) { } # find parents from the commit itself -my @commit = safe_pipe_capture('git-cat-file', 'commit', $commit); +my @commit = safe_pipe_capture('git', 'cat-file', 'commit', $commit); my @parents; my $committer; my $author; @@ -162,9 +162,9 @@ if ($opt_a) { close MSG; if ($parent eq $noparent) { - `git-diff-tree --binary -p --root $commit >.cvsexportcommit.diff`;# || die "Cannot diff"; + `git diff-tree --binary -p --root $commit >.cvsexportcommit.diff`;# || die "Cannot diff"; } else { - `git-diff-tree --binary -p $parent $commit >.cvsexportcommit.diff`;# || die "Cannot diff"; + `git diff-tree --binary -p $parent $commit >.cvsexportcommit.diff`;# || die "Cannot diff"; } ## apply non-binary changes @@ -178,7 +178,7 @@ my $context = $opt_p ? '' : '-C1'; print "Checking if patch will apply\n"; my @stat; -open APPLY, "GIT_INDEX_FILE=$tmpdir/index git-apply $context --summary --numstat<.cvsexportcommit.diff|" || die "cannot patch"; +open APPLY, "GIT_INDEX_FILE=$tmpdir/index git apply $context --summary --numstat<.cvsexportcommit.diff|" || die "cannot patch"; @stat=; close APPLY || die "Cannot patch"; my (@bfiles,@files,@afiles,@dfiles); @@ -333,7 +333,7 @@ print "Applying\n"; if ($opt_W) { system("git checkout -q $commit^0") && die "cannot patch"; } else { - `GIT_INDEX_FILE=$tmpdir/index git-apply $context --summary --numstat --apply <.cvsexportcommit.diff` || die "cannot patch"; + `GIT_INDEX_FILE=$tmpdir/index git apply $context --summary --numstat --apply <.cvsexportcommit.diff` || die "cannot patch"; } print "Patch applied successfully. Adding new files and directories to CVS\n"; -- cgit v0.10.2-6-g49f6 From c0e190c168becfd7d6c27cd868542295bd474742 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 26 Aug 2020 14:37:39 -0700 Subject: credential-cache: use child_process.args As child_process structure has an embedded strvec args for formulating the command line, let's use it instead of using an out-of-line argv[] whose length needs to be maintained correctly. Also, when spawning a git subcommand, omit it from the command list and instead use the .git_cmd bit in the child_process structure. Signed-off-by: Junio C Hamano diff --git a/credential-cache.c b/credential-cache.c index 1cccc3a..04df61c 100644 --- a/credential-cache.c +++ b/credential-cache.c @@ -39,13 +39,13 @@ static int send_request(const char *socket, const struct strbuf *out) static void spawn_daemon(const char *socket) { struct child_process daemon = CHILD_PROCESS_INIT; - const char *argv[] = { NULL, NULL, NULL }; char buf[128]; int r; - argv[0] = "git-credential-cache--daemon"; - argv[1] = socket; - daemon.argv = argv; + strvec_pushl(&daemon.args, + "credential-cache--daemon", socket, + NULL); + daemon.git_cmd = 1; daemon.no_stdin = 1; daemon.out = -1; -- cgit v0.10.2-6-g49f6