Edward Thomson <ethom...@edwardthomson.com> writes:

>       if (trust_executable_bit && has_symlinks)
>               ce->ce_mode = create_ce_mode(st_mode);
> +     else if (force_executable)
> +             ce->ce_mode = create_ce_mode(0777);
> +     else if (force_notexecutable)
> +             ce->ce_mode = create_ce_mode(0666);
>       else {
>               /* If there is an existing entry, pick the mode bits and type
>                * from it, otherwise assume unexecutable regular file.

I would rather do this part more like:

        if (S_ISREG(st_mode) && (force_executable || force_nonexecuable)) {
                if (force_executable)
                        ce->ce_mode = create_ce_mode(0777);
                else
                        ce->ce_mode = create_ce_mode(0666);
        } else if (trust_executable_bit && has_symlinks) {
                ce->ce_mode = create_ce_mode(st_mode);
        } else {
                ... carry the existing mode over ...

which would make sure that the new code will not interfere with
symbolic links and that forcing will be honored even on filesystems
whose executable bit can be trusted (i.e. "can be trusted" does not
have to mean "must be trusted").

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

Reply via email to