3 ms·
> One could use the 'strings' command to get detailed information about what files were used in a binary and which version! DVCS (git) broke that, so most peopl
by mananaysiempre 3y ago
> One could use the 'strings' command to get detailed information about what files were used in a binary and which version! DVCS (git) broke that, so most people don't remember. [...]
> Consider: A file exists in a git repository under a hash, which theoretically (excluding hash collisions) uniquely identifies a file.
Git is of course incapable of including a file version number, as that’s not really well-defined in a distributed setting. But if you’re OK with a blob hash, put $Id$ in your source files, mark them with “ident” in .gitattributes, and you’ll see the hashes included and autoupdated on your next checkout[1]:
> When the attribute `ident` is set for a path, Git replaces $Id$ in the blob object with $Id:, followed by the 40-character hexadecimal blob object name, followed by a dollar sign $ upon checkout. Any byte sequence that begins with $Id: and ends with $ in the worktree file is replaced with $Id$ upon check-in.
[1] https://git-scm.com/docs/gitattributes#_ident https://git-scm.com/docs/gitattributes#_ident