desktop
desktop copied to clipboard
Permission changes are classified as whitespace changes
Describe the bug
Even though file permissions are unrelated to whitespace, both the staged and commit change views will incorrectly report that a change to file permissions is a change to whitespace.
Version & OS
- GitHub Desktop: 2.6.4
- Operating System: macOS Big Sur 11.2.2
Steps to reproduce the behavior
- Run
chmod +x <file>
- Select the file in GitHub Desktop
- Run
git diff <file>
- Observe that GitHub Desktop reports "Only file permission changes found"
Expected behavior
When the 'hide whitespace changes' option is enabled, the view should display "No content changes found", or if a more specific message is desired, both views should display "Only file permission changes found".
Actual behavior
If the 'hide whitespace changes' option is enabled, the view displays "Only whitespace changes found". Otherwise, it displays "No content changes found".
Screenshots
Thanks @haykam821! @say25 Any ideas here since you did a lot of the work on the whitespace features?
General Guidance
@haykam821 I believe you actually need to run a command like git update-index --chmod=+x README.md
for what you need to work. I've run into it a fair amount writing and editing bash scripts on Windows :sob: I ended up writing this - https://github.com/say25/docs/blob/master/bash/git-chmod
Triage
We don't actually support Hide Whitespace Changes on the Changes tab as the screenshot above implies (yet) - Hopefully coming soon in https://github.com/desktop/desktop/pull/6818 but this PR just had its first birthday (wink wink @billygriffin 😛)
Problem Statement
GitHub Desktop doesn't really support CHMOD well for a few reasons:
- If you try to commit just a CHMOD change in GitHub Desktop you actually will hit this error - chmod commit failure image and after you click close on the
There are no changes to commit
dialog, Desktop will actually discard your changes - You will actually not see what permission changes occur within Desktop (there is also no way to change permissions either, but this is probably an "advanced workflow" so maybe that is ok?)
- If you view a commit in the history tab with only a CHMOD change, the behavior described above where you will see
Only whitespace changes found
will indeed occur
Proposed Solutions
- Get GitHub Desktop to support these workflows from a commit prospective (assuming you have the changes on your branch and you solely want Desktop to commit them)
- Add Permissions Changes to the GitHub Desktop UI - Example from GitHub.com UI - permission change image - Fake PR Screenshotted as example - https://github.com/say25/docs/pull/3/files
- In addition, maybe we should make the
Only whitespace changes found
"smarter" to handle no content changes to begin with
Reported again in https://github.com/desktop/desktop/issues/16575.