summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 278fcd7)
raw | patch | inline | side by side (parent: 278fcd7)
author | Jim Meyering <jim@meyering.net> | |
Mon, 4 Dec 2006 07:44:08 +0000 (08:44 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 4 Dec 2006 21:34:45 +0000 (13:34 -0800) |
Otherwise, an executable script in git would end up being
checked into the CVS repository without the execute bit.
[jc: with an additional test script from Robin Rosenberg.]
Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
checked into the CVS repository without the execute bit.
[jc: with an additional test script from Robin Rosenberg.]
Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-cvsexportcommit.perl | patch | blob | history | |
t/t9200-git-cvsexportcommit.sh | patch | blob | history |
index 7bac16e9463a0d0119218458b853570be6188ff4..c9d1d88f2eafd9c3fa1ffec9ad9e7d997928c709 100755 (executable)
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
close MSG;
my (@afiles, @dfiles, @mfiles, @dirs);
+my %amodes;
my @files = safe_pipe_capture('git-diff-tree', '-r', $parent, $commit);
#print @files;
$? && die "Error in git-diff-tree";
my @fields = split(m!\s+!, $f);
if ($fields[4] eq 'A') {
my $path = $fields[5];
+ $amodes{$path} = $fields[1];
push @afiles, $path;
# add any needed parent directories
$path = dirname $path;
}
foreach my $f (@afiles) {
+ set_new_file_permissions($f, $amodes{$f});
if (grep { $_ eq $f } @bfiles) {
system('cvs', 'add','-kb',$f);
} else {
}
return wantarray ? @output : join('',@output);
}
+
+# For any file we want to add to cvs, we must first set its permissions
+# properly, *before* the "cvs add ..." command. Otherwise, it is impossible
+# to change the permission of the file in the CVS repository using only cvs
+# commands. This should be fixed in cvs-1.12.14.
+sub set_new_file_permissions {
+ my ($file, $perm) = @_;
+ chmod oct($perm), $file
+ or die "failed to set permissions of \"$file\": $!\n";
+}
index 6e566d44093c5b6fc4a6a891b0ae9473e672b56d..c1024790e41693097d588b3c544a2e4b15ed71bf 100755 (executable)
diff F/newfile6.png ../F/newfile6.png
)'
+test_expect_success 'Retain execute bit' '
+ mkdir G &&
+ echo executeon >G/on &&
+ chmod +x G/on &&
+ echo executeoff >G/off &&
+ git add G/on &&
+ git add G/off &&
+ git commit -a -m "Execute test" &&
+ (
+ cd "$CVSWORK" &&
+ git-cvsexportcommit -c HEAD
+ test -x G/on &&
+ ! test -x G/off
+ )
+'
+
test_done