@matheusbsbs / matheus-bagliano / commits / 7cff3b67ac
Fork 0

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 <gitster@pobox.com>

Junio C Hamano committed Aug 26, 2020 at 12:46 UTC 7cff3b67aca11f757fb36ac58a89ae54bcb5b19e
1 file changed +8 -8
git-cvsexportcommit.perl
+8 -8
@@ -30,7 +30,7 @@ if ($opt_w || $opt_W) {
30 # Remember where GIT_DIR is before changing to CVS checkout
31 unless ($ENV{GIT_DIR}) {
32 # No GIT_DIR set. Figure it out for ourselves
33 - my $gd =`git-rev-parse --git-dir`;
33 + my $gd =`git rev-parse --git-dir`;
34 chomp($gd);
35 $ENV{GIT_DIR} = $gd;
36 }
@@ -66,7 +66,7 @@ if ($opt_d) {
66 # resolve target commit
67 my $commit;
68 $commit = pop @ARGV;
69 -$commit = safe_pipe_capture('git-rev-parse', '--verify', "$commit^0");
69 +$commit = safe_pipe_capture('git', 'rev-parse', '--verify', "$commit^0");
70 chomp $commit;
71 if ($?) {
72 die "The commit reference $commit did not resolve!";
@@ -76,7 +76,7 @@ if ($?) {
76 my $parent;
77 if (@ARGV) {
78 $parent = pop @ARGV;
79 - $parent = safe_pipe_capture('git-rev-parse', '--verify', "$parent^0");
79 + $parent = safe_pipe_capture('git', 'rev-parse', '--verify', "$parent^0");
80 chomp $parent;
81 if ($?) {
82 die "The parent reference did not resolve!";
@@ -84,7 +84,7 @@ if (@ARGV) {
84 }
85
86 # find parents from the commit itself
87 -my @commit = safe_pipe_capture('git-cat-file', 'commit', $commit);
87 +my @commit = safe_pipe_capture('git', 'cat-file', 'commit', $commit);
88 my @parents;
89 my $committer;
90 my $author;
@@ -162,9 +162,9 @@ if ($opt_a) {
162 close MSG;
163
164 if ($parent eq $noparent) {
165 - `git-diff-tree --binary -p --root $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
165 + `git diff-tree --binary -p --root $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
166 } else {
167 - `git-diff-tree --binary -p $parent $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
167 + `git diff-tree --binary -p $parent $commit >.cvsexportcommit.diff`;# || die "Cannot diff";
168 }
169
170 ## apply non-binary changes
@@ -178,7 +178,7 @@ my $context = $opt_p ? '' : '-C1';
178 print "Checking if patch will apply\n";
179
180 my @stat;
181 -open APPLY, "GIT_INDEX_FILE=$tmpdir/index git-apply $context --summary --numstat<.cvsexportcommit.diff|" || die "cannot patch";
181 +open APPLY, "GIT_INDEX_FILE=$tmpdir/index git apply $context --summary --numstat<.cvsexportcommit.diff|" || die "cannot patch";
182 @stat=<APPLY>;
183 close APPLY || die "Cannot patch";
184 my (@bfiles,@files,@afiles,@dfiles);
@@ -333,7 +333,7 @@ print "Applying\n";
333 if ($opt_W) {
334 system("git checkout -q $commit^0") && die "cannot patch";
335 } else {
336 - `GIT_INDEX_FILE=$tmpdir/index git-apply $context --summary --numstat --apply <.cvsexportcommit.diff` || die "cannot patch";
336 + `GIT_INDEX_FILE=$tmpdir/index git apply $context --summary --numstat --apply <.cvsexportcommit.diff` || die "cannot patch";
337 }
338
339 print "Patch applied successfully. Adding new files and directories to CVS\n";