Last active
February 28, 2020 12:26
-
-
Save treyharris/f6ced9d61f451cc69f48 to your computer and use it in GitHub Desktop.
Example of why ident attribute doesn't work in Git like CSV/SVN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# Make any non-zero return fatal just in case | |
setopt err_exit | |
source =(curl https://gist.githubusercontent.com/treyharris/c486c9f8776802e270b7/raw/2d0519826f3b8ca8446f59211ecd0dc738221d3d/showshell.zsh 2> /dev/null) | |
local dir=/tmp/ident-test | |
local files=5 | |
show "Setting up ${dir}" " | |
rm -rf ${dir} | |
mkdir ${dir} | |
cd ${dir} | |
" | |
show "Setting up git" " | |
git init | |
echo '*.txt ident' > .gitattributes | |
" | |
for file ({1..${files}}.txt) { | |
echo '$Id$' > ${file} | |
git add "${file}" | |
git commit -m "Adding ${file}" | |
} | |
show "Show we do have ${files} commits for each file:" " | |
git log --stat --oneline --decorate | |
" | |
show "Show the current contents" " | |
cat *.txt | |
" | |
show "Git doesn't replace the \$Id\$ token until it must write the file" " | |
rm * | |
git reset --hard | |
cat *.txt | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment