Re: Set permissions of each new file before "cvs add"ing it.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jim Meyering <jim@xxxxxxxxxxxx> writes:

> Without the following patch, git-cvsexportcommit would fail to propagate
> permissions of files added in git to the CVS repository.  I.e., when I
> added an executable script in coreutils' git repo, then tried to propagate
> that addition to the mirroring CVS repository, the script ended up added
> not executable there.

Thanks.  But...

> +# 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) = @_;
> +    # Given input like this:
> +    # ba45154d8e9f5f49f46c8c2c2d8a554db7c3465f ...
> +    # :000000 100755 0000000... b595dc6... A  tests/du/one-file-system
> +    # extract the three octal permission digits:
> +    my $cmd = 'git-whatchanged --max-count=1 --pretty=oneline -- $f'
> +      . q! | sed -n '2s/^:00* [0-7][0-7][0-7]\([0-7][0-7][0-7]\) .*/\1/p'!;
> +    my $perm = `$cmd`;
> +
> +    chmod oct($perm), $file
> +      or die "failed to set permissions of \"$file\": $!\n";
> +}

Why sed in a Perl script ;-)?

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]