Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # $Title: After `git commit' do "ls -l" on files touched by commit $
- # NB: To use, copy to <git_project>/.git/hooks/post-commit
- git show --name-only --format= | awk '
- BEGIN {
- c = split("a\ab\bt\tn\nv\vf\fr\r\"\"", cmap, "")
- for (n = 1; n < c; n += 2) map["\\\\" cmap[n]] = cmap[n+1]
- }
- function o2d(oct) {
- dec = 0
- while ((o = substr(oct, 1, 1)) ~ /[0-7]/) {
- dec = (dec + o) * 8
- oct = substr(oct, 2)
- }
- return dec / 8
- }
- {
- if (/^".*"$/) $0 = substr($0, 2, length($0) - 2)
- for (m in map) gsub(m, map[m]); gsub(/\\\\/, "\\")
- while (match($0, /\\[[:digit:]]+/))
- $0 = sprintf("%s%c%s", substr($0, 1, RSTART - 1),
- o2d(substr($0, RSTART + 1, RLENGTH - 1)),
- substr($0, RSTART + RLENGTH))
- printf "%s%c", $0, 0
- }
- ' | xargs -0 ls -l -- || :
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement