ocp-indent -iwould first output in a fresh temporary file then mv that file to the original one.
Doing that overwrites file permission and transforms symlinks into copies, which is probably not the expected behavior (unless you don't know how to do chmod).
The new version does the same but makes sure to overwrite the linked file and to preserve file permissions.
I did not handle the case of a file under a different uid/gid, but @AltGr agreed that "why would anyone need that anyway?"
Noteworthy information: this adds a dependency to Unix.
What happened before:
ocp-indent -i
would first output in a fresh temporary file thenmv
that file to the original one.Doing that overwrites file permission and transforms symlinks into copies, which is probably not the expected behavior (unless you don't know how to do
chmod
).The new version does the same but makes sure to overwrite the linked file and to preserve file permissions.
I did not handle the case of a file under a different uid/gid, but @AltGr agreed that "why would anyone need that anyway?"
Noteworthy information: this adds a dependency to
Unix
.