Show changes to file permissions in diffs and pull requests

Issue #11961 closed
Alex Chan
created an issue

Sometimes a developer will accidentally change the permissions on a file, and check in the change. It would be good to spot these changes before they cause problems, ideally as part of code review when looking at a pull request.

The current web interface doesn't expose this information.

Here's an example commit diff. Which files have changed permissions?

fileperms2.png

The answer is both of them, but it's hard to spot. The fact that the latter is in the diff with no apparent changes is a hint that the second file has different permissions; I can't see anything to indicate the change in the first file.

Even when I know the permissions have changed, I don't know what the old/new permissions are; this is also useful.

Please add something to the diff view that:

  • Highlights when the file permissions have changed
  • Tells me the old and new permissions

Comments (11)

  1. Christopher Cordahi

    Sorry, but I don't understand the explanation.

    • Git (and Bitbucket) support changes in file content, file name and file permission.
    • If the file content or the file name changes, the Bitbucket UI displays this change this correctly.
    • However if the file permission changes, the Bitbucket UI hides this change. Why?
    • Saying permissions don't matter is like saying file name doesn't matter or whitespace doesn't matter. FYI, they do.

    I just encountered this problem. As @Alex Chan wrote "Sometimes a developer will accidentally change the permissions on a file, and check in the change." I was the developer who made the mistake, but I expect my tools to help me catch and correct my mistakes. Both I and another reviewer failed to detect this error because the UI displayed the expected change

    File renamed but contents unchanged.
    

    while hiding my inadvertent mistake.

    The desired information is available, it's just hidden in the view raw commit which contains

    deleted file mode 100755
    new file mode 100644
    

    One of the main reasons developers use nice UIs like Bitbucket is so that we don't have to hunt through these raw commit text messages.

  2. Krzysztof Wasilewski

    +1

    would be nice to have some info about modes like in git (old and new modes) or simply if executable bit was added or removed

    $ git show
    commit cab355374da94f186ab0672db3c4a66d5f010c46 (HEAD)
    Author: Krzysztof Wasilewski <>
    Date:   Tue Jun 5 11:19:21 2018 +0200
    
        Allow exec script.
    
    diff --git a/a2.sh b/a2.sh
    old mode 100644
    new mode 100755
    
  3. Yoav Baras

    +1 This is definitely required. Like the reporter @Alex Chan said, reviewers need to see if a developer accidentally committed changes to the file mode.

    I just updated my branch and got this:

     21 files changed, 182 insertions(+), 31 deletions(-)
     mode change 100644 => 100755 advanced-custom-field.xml
     mode change 100644 => 100755 css/skins/style-black.css
     mode change 100644 => 100755 css/skins/style-black.css.map
     mode change 100644 => 100755 css/skins/style-black.min.css
     mode change 100644 => 100755 css/skins/style-black.min.css.map
    
  4. Log in to comment