Skip to content

Expose the file mode permissions #125

@ericwb

Description

@ericwb

There are cases where it is very useful to know the file mode in the diff.

The file mode 120000 corresponds to a symbolic link. For us this is essential to know whether we want to review the diff or not. If this symlink indicator is ignored, the diff appears as a new file with a 1-line change instead of a link with a link target.

diff --git a/bin/check b/bin/check
new file mode 120000
index 000000000..f35a09670
--- /dev/null
+++ b/bin/check
@@ -0,0 +1 @@
+.pyenv-wrapper
\ No newline at end of file

The current code base uses RE_DIFF_GIT_NEW_FILE and RE_DIFF_GIT_DELETED_FILE to parse the file mode line. But it doesn't expose or otherwise do anything with the actual mode value.

But the diff can include file mode on other lines:

diff --git a/server.py b/bin/server.py
old mode 100644
new mode 100755
similarity index 79%
rename from server.py
rename to bin/server.py
index 596da840d..99589d9fa
--- a/server.py
+++ b/bin/server.py
@@ -1,4 +1,5 @@
diff --git a/info.sh b/info.sh
index ddbe53c40..6c84b8acf 100755
--- a/info.sh
+++ b/info.sh
@@ -1,5 +1,5 @@

Example of a link being updated:

diff --git a/test b/test
index f35a09670..f03451501 120000
--- a/test
+++ b/test
@@ -1 +1 @@
-.pyenv-wrapper
\ No newline at end of file
+verinfo.sh
\ No newline at end of file

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions