Skip to content

Commit

Permalink
cvsexportcommit: do not run git programs in dashed form
Browse files Browse the repository at this point in the history
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 <gitster@pobox.com>
  • Loading branch information
gitster committed Aug 26, 2020
1 parent 675df19 commit 7cff3b6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions git-cvsexportcommit.perl
Expand Up @@ -30,7 +30,7 @@
# 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;
}
Expand Down Expand Up @@ -66,7 +66,7 @@
# 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!";
Expand All @@ -76,15 +76,15 @@
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!";
}
}

# 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;
Expand Down Expand Up @@ -162,9 +162,9 @@
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
Expand All @@ -178,7 +178,7 @@
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=<APPLY>;
close APPLY || die "Cannot patch";
my (@bfiles,@files,@afiles,@dfiles);
Expand Down Expand Up @@ -333,7 +333,7 @@
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";
Expand Down

0 comments on commit 7cff3b6

Please sign in to comment.