Skip to content

Commit 04b3577

Browse files
committed
Merge branch 'jk/maint-cvsimport-pathname' into maint
* jk/maint-cvsimport-pathname: cvsimport: fix relative argument filenames
2 parents a25a2cd + f6fdbb6 commit 04b3577

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

git-cvsimport.perl

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,10 +579,21 @@ ($)
579579
return $r;
580580
}
581581

582+
my $user_filename_prepend = '';
583+
sub munge_user_filename {
584+
my $name = shift;
585+
return File::Spec->file_name_is_absolute($name) ?
586+
$name :
587+
$user_filename_prepend . $name;
588+
}
589+
582590
-d $git_tree
583591
or mkdir($git_tree,0777)
584592
or die "Could not create $git_tree: $!";
585-
chdir($git_tree);
593+
if ($git_tree ne '.') {
594+
$user_filename_prepend = getwd() . '/';
595+
chdir($git_tree);
596+
}
586597

587598
my $last_branch = "";
588599
my $orig_branch = "";
@@ -644,7 +655,7 @@ ($)
644655
-f "$git_dir/cvs-authors" and
645656
read_author_info("$git_dir/cvs-authors");
646657
if ($opt_A) {
647-
read_author_info($opt_A);
658+
read_author_info(munge_user_filename($opt_A));
648659
write_author_info("$git_dir/cvs-authors");
649660
}
650661

@@ -679,7 +690,7 @@ ($)
679690
$? == 0 or die "git-cvsimport: fatal: cvsps reported error\n";
680691
close $cvspsfh;
681692
} else {
682-
$cvspsfile = $opt_P;
693+
$cvspsfile = munge_user_filename($opt_P);
683694
}
684695

685696
open(CVS, "<$cvspsfile") or die $!;

0 commit comments

Comments
 (0)