summaryrefslogtreecommitdiff
path: root/pre-commit.d
diff options
context:
space:
mode:
authorScott Bronson <b.git@u32.net>2008-03-14 18:07:33 -0700
committerScott Bronson <b.git@u32.net>2008-03-17 00:03:23 -0700
commit3b3a5fa7b090b26996883c9f28145190b9cd2168 (patch)
tree0fa61cb184171111c244796cae805456fc3936a0 /pre-commit.d
parent96d01fc0eb61dbc3a009a456b3ccd4ce517faf8d (diff)
Prune .bzr and .hg now (as well as .git) when running the find commands.
Diffstat (limited to 'pre-commit.d')
-rwxr-xr-xpre-commit.d/30store-metadata21
1 files changed, 12 insertions, 9 deletions
diff --git a/pre-commit.d/30store-metadata b/pre-commit.d/30store-metadata
index 363788e..5190a2c 100755
--- a/pre-commit.d/30store-metadata
+++ b/pre-commit.d/30store-metadata
@@ -18,24 +18,27 @@ filter_unknown() {
generate_metadata() {
# This function generates the script commands to fix any files
# that aren't owner=root, group=root, or mode=0644 or 0755.
- # Script is produced on stdout. Errors go to stderr.
+ # The script is produced on stdout. Errors go to stderr.
+
+ # We maintain the permissions on the directory containing VCS data
+ # but we want find to ignore the VCS files themselves.
+ NOVCS='. -wholename ./.git -prune -o -wholename ./.bzr -prune -o -wholename ./.hg -prune -o'
# Find all files and directories that don't have root as the owner
- find . \! -user root -exec stat --format="chown %U {}" {} \; \
+ find $NOVCS \! -user root -exec stat --format="chown %U {}" {} \; \
| sort | filter_unknown chown owner
# Find all files and directories that don't have root as the group
- find . \! -group root -exec stat --format="chgrp %G {}" {} \; \
+ find $NOVCS \! -group root -exec stat --format="chgrp %G {}" {} \; \
| sort | filter_unknown chgrp group
# Find all directories that aren't 0755
- find . -type d \! -perm 0755 -exec stat --format="chmod %a {}" {} \; | sort
+ find $NOVCS -type d \! -perm 0755 \
+ -exec stat --format="chmod %a {}" {} \; | sort
# Find all files that aren't 0644 or 0755 (we can assume the VCS will
- # maintain the executable bit). All the files in the
- # /etc/.git/objects directory are 0444 so we'll specifically avoid it.
- find . -wholename ./.git -prune -o \
- -type f \! -perm 0644 \! -perm 0755 -exec stat --format="chmod %a {}" {} \; \
- | sort
+ # maintain the executable bit).
+ find $NOVCS -type f \! -perm 0644 \! -perm 0755 \
+ -exec stat --format="chmod %a {}" {} \; | sort
# We don't handle xattrs.
# Maybe check for getfattr/setfattr and use them if they're available?