Usage info is emebed in the script, but the gist of it is to run the script
from a pre-commit hook to save permissions/ownership data to a file and check
that file into the repository. Then, a post_merge hook reads the file and
updates working tree permissions/ownership. All updates are transparent to
the user (although there is a --verbose option). Merge conflicts are handled
in the "read" phase (in pre-commit), and the script aborts the commit and
tells you how to fix things in the case of a merge conflict in the metadata
file. This same idea could be extended to handle file ACLs or other file
metadata if desired.
Signed-off-by: Josh England <jjengla@sandia.gov>
---
This script sorta requires the post-merge hook to work really well.
Documentation/hooks.txt | 3 +-
contrib/hooks/setgitperms.perl | 213 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 215 insertions(+), 1 deletions(-)
create mode 100644 contrib/hooks/setgitperms.perl
diff --git a/Documentation/hooks.txt b/Documentation/hooks.txt
index 50535a7..58b9547 100644
--- a/Documentation/hooks.txt
+++ b/Documentation/hooks.txt
@@ -97,7 +97,8 @@ This hook cannot affect the outcome of `git-merge`.
This hook can be used in conjunction with a corresponding pre-commit hook to
save and restore any form of metadata associated with the working tree
-(eg: permissions/ownership, ACLS, etc).
+(eg: permissions/ownership, ACLS, etc). See contrib/hooks/setgitperms.perl
+for an example of how to do this.
[[pre-receive]]
pre-receive
diff --git a/contrib/hooks/setgitperms.perl b/contrib/hooks/setgitperms.perl
new file mode 100644
index 0000000..b3fb446
--- /dev/null
+++ b/contrib/hooks/setgitperms.perl
@@ -0,0 +1,213 @@
+#!/usr/bin/perl
+#
+# Copyright (c) 2006 Josh England
+#
+# This script can be used to save/restore full permissions and ownership data
+# within a git working tree.
+#
+# To save permissions/ownership data, place this script in your .git/hooks
+# directory and ena...