to...@tuxteam.de wrote: > On Sat, Mar 15, 2025 at 07:50:27PM +0000, Tim Woodall wrote: >> git fails to preserve ownership, permissions or timestamps. While this may > [...] > > Half-wrong. Git doesn't preserve ownerships, but it does preserve > permissions (the POSIX things).
Still quarter(?)-wrong. ;) It's misleading (at best) to say git preserves permissions. It simply tracks whether a file is executable or not. That isn't the same as tracking permissions. If you set a file to mode 2755, git doesn't record any change and will not restore the file with the setgid bit. $ git init /tmp/test && cd /tmp/test Initialized empty Git repository in /tmp/test/.git/ $ >foo $ git add foo && git commit -m 'add foo' [main (root-commit) 0925be1] add foo 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 foo $ chmod -c g+s foo mode of 'foo' changed from 0644 (rw-r--r--) to 2644 (rw-r-Sr--) $ ls -l foo -rw-r-Sr--. 1 todd todd 0 Mar 16 09:49 foo $ git status On branch main nothing to commit, working tree clean $ rm -f foo ; git restore foo $ ls -l foo -rw-r--r--. 1 todd todd 0 Mar 16 09:50 foo > As for timestamps, it records the last commit timestamp, > which may be a "good enough" approximation of the mtime or > not. Notably, for use in a backup system, git doesn't set the timestamp to the last change time when it restores or checks out a file, so you'd have to do that manually if you're using it as backup system and you care about the timestamps. Of course, if you're using git as the primary backup tool, you might not care deeply about the timestamps, which is fine. -- Todd
signature.asc
Description: PGP signature