Set u+x on scripts.
[git-central.git] / scripts / create-gitconfig
1 #!/bin/sh
2 #
3 # Creates a separate DAG in your repo for git config files.
4 #
5 # This allows you to checkout/modify/push the config/hooks for your repo
6 # locally. Then, with the help of post-receive-gitconfig, have your changes be
7 # automatically updated on the server.
8 #
9 # Also, it keeps all of your repo-specific information in your repo instead of
10 # leaking out into potentiallyshared hook scripts.
11 #
12
13 # Create an empty file object
14 empty_file_hash=$(git hash-object -w --stdin <<FOO
15 FOO)
16
17 # Make a root directory tree with the config file in it
18 config_tree_hash=$(git mktree <<FOO
19 100644 blob $empty_file_hash    config
20 FOO)
21
22 # Commit the root directory tree
23 commit_hash=$(git commit-tree $config_tree_hash <<FOO
24 Initial commit on config branch.
25 FOO)
26
27 # Push the commit out to the gitconfig branch
28 git update-ref refs/heads/gitconfig "$commit_hash" 0000000000000000000000000000000000000000
29