Diff explorer shows "empty file" for non-zero length file with permissions change #6814
Replies: 5 comments 2 replies
-
This is not an answer, but I wanted to add a +1 to this. It is quite confusing and has led to a bit of wasted time amongst our developers. Not sure if it is showing due to permission changes on our end or not. It should follow the flow/behaviour of everything else. Or, give a better explanation of the change instead of "Empty file." |
Beta Was this translation helpful? Give feedback.
-
I faced this problem after changing the permissions of my files locally. I just reverted that. Following this instructions: https://gist.github.com/liitfr/86c77bf0ea4a627ab9b62ad30c32c251 |
Beta Was this translation helpful? Give feedback.
-
The solution for me was to make some small change to the file (e.g. add whitespace) and the push. The entire diff now shows again. You can revert the whitespace addition if needed. |
Beta Was this translation helpful? Give feedback.
-
How is this bug still unaddressed after 3 years? The page logic just needs to know whether what is being rendered is a diff or a file, and change the message to |
Beta Was this translation helpful? Give feedback.
-
When I change the permissions of a file, but otherwise make no other changes, diffs claim the file is empty. From this demo:
This is confusing. Users expect that to somehow indicate that no changes were made, not that the file is now empty. For consistency, users may even expect to be able to expand the file in place to see its (unchanged) contents like they can with other files.
👈 Note that the "expand all" icon is missing for files with contents whose permissions are changed with no other edits.
Note that the same behavior is present when viewing commits (see, e.g., this and this).
A colleague who is new to GitHub brought this to my attention. He thought that meant I had deleted the contents of the file and pulled my branch down to examine it by hand. I realize he could have selected
View file
from the…
menu, but he was unaware of that. Further, given the behavior of the other files in the diff (whose unchanged portions could be expanded in place), he didn't even think to look for that option. He was expecting to be able to expand it in place if it had contents, which is entirely reasonable. I'm kind of surprised this isn't already the behavior.Beta Was this translation helpful? Give feedback.
All reactions