dm-is-reflective 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/.gita/COMMIT_EDITMSG +9 -0
  2. data/.gita/HEAD +1 -0
  3. data/.gita/ORIG_HEAD +1 -0
  4. data/.gita/RENAMED-REF +1 -0
  5. data/.gita/config +9 -0
  6. data/.gita/description +1 -0
  7. data/.gita/gitk.cache +6 -0
  8. data/.gita/hooks/applypatch-msg +15 -0
  9. data/.gita/hooks/commit-msg +24 -0
  10. data/.gita/hooks/post-commit +8 -0
  11. data/.gita/hooks/post-receive +16 -0
  12. data/.gita/hooks/post-update +8 -0
  13. data/.gita/hooks/pre-applypatch +14 -0
  14. data/.gita/hooks/pre-commit +70 -0
  15. data/.gita/hooks/pre-rebase +150 -0
  16. data/.gita/hooks/prepare-commit-msg +36 -0
  17. data/.gita/hooks/update +107 -0
  18. data/.gita/index +0 -0
  19. data/.gita/info/exclude +6 -0
  20. data/.gita/info/refs +26 -0
  21. data/.gita/logs/HEAD +40 -0
  22. data/.gita/logs/refs/heads/dm-mapping +1 -0
  23. data/.gita/logs/refs/heads/master +40 -0
  24. data/.gita/logs/refs/heads/return-symbol +0 -0
  25. data/.gita/logs/refs/remotes/origin/dm-mapping +1 -0
  26. data/.gita/logs/refs/remotes/origin/master +6 -0
  27. data/.gita/logs/refs/remotes/origin/return-symbol +0 -0
  28. data/.gita/objects/5c/91380a1616b7c2d23e14eeb49d9edde58e1f47 +2 -0
  29. data/.gita/objects/63/71947bcb9c0dd1d3b3d6f449b2d4b4c6c81e63 +0 -0
  30. data/.gita/objects/73/23ae22118cc54fb0bbb0d6f51cc99191019b96 +0 -0
  31. data/.gita/objects/81/a0ab6e4dbd148faa0644307b313799027d3344 +2 -0
  32. data/.gita/objects/b2/9571a21e3bccb60079dfca630dac981f623489 +5 -0
  33. data/.gita/objects/cb/138acf9efc0f5b3ff91c644cae4dec868442e4 +5 -0
  34. data/.gita/objects/d5/66699fc7ba5237311cc44648d0cd2abbaa895e +0 -0
  35. data/.gita/objects/info/packs +2 -0
  36. data/.gita/objects/pack/pack-c9156ef3406b98f5f12875b13643df7a5f41e42c.idx +0 -0
  37. data/.gita/objects/pack/pack-c9156ef3406b98f5f12875b13643df7a5f41e42c.pack +0 -0
  38. data/.gita/packed-refs +27 -0
  39. data/.gita/refs/heads/master +1 -0
  40. data/.gita/refs/tags/dm-is-reflective-0.8.0 +1 -0
  41. data/CHANGES +189 -0
  42. data/LICENSE +201 -0
  43. data/NOTICE +30 -0
  44. data/README +122 -0
  45. data/Rakefile +45 -0
  46. data/TODO +7 -0
  47. data/dm-is-reflective.gemspec +41 -0
  48. data/lib/dm-is-reflective.rb +10 -0
  49. data/lib/dm-is-reflective/is/adapters/abstract_adapter.rb +144 -0
  50. data/lib/dm-is-reflective/is/adapters/mysql_adapter.rb +62 -0
  51. data/lib/dm-is-reflective/is/adapters/postgres_adapter.rb +84 -0
  52. data/lib/dm-is-reflective/is/adapters/sqlite3_adapter.rb +61 -0
  53. data/lib/dm-is-reflective/is/reflective.rb +78 -0
  54. data/lib/dm-is-reflective/is/version.rb +7 -0
  55. data/lib/dm-is-reflective/version.rb +7 -0
  56. data/tasks/ann.rake +80 -0
  57. data/tasks/bones.rake +20 -0
  58. data/tasks/gem.rake +201 -0
  59. data/tasks/git.rake +40 -0
  60. data/tasks/notes.rake +27 -0
  61. data/tasks/post_load.rake +34 -0
  62. data/tasks/rdoc.rake +51 -0
  63. data/tasks/rubyforge.rake +55 -0
  64. data/tasks/setup.rb +294 -0
  65. data/tasks/spec.rake +54 -0
  66. data/tasks/svn.rake +47 -0
  67. data/tasks/test.rake +40 -0
  68. data/tasks/zentest.rake +36 -0
  69. data/test/abstract.rb +250 -0
  70. data/test/test_dm-is-reflexible.rb +48 -0
  71. metadata +203 -0
@@ -0,0 +1,9 @@
1
+ [CHANGES] adapted to dm-core 0.10.0. first rubyforge gem release.
2
+ # Please enter the commit message for your changes. Lines starting
3
+ # with '#' will be ignored, and an empty message aborts the commit.
4
+ # On branch master
5
+ # Changes to be committed:
6
+ # (use "git reset HEAD <file>..." to unstage)
7
+ #
8
+ # modified: CHANGES
9
+ #
data/.gita/HEAD ADDED
@@ -0,0 +1 @@
1
+ ref: refs/heads/master
data/.gita/ORIG_HEAD ADDED
@@ -0,0 +1 @@
1
+ 98f83544a720cc88a3cd88618520affaee2fb5b0
data/.gita/RENAMED-REF ADDED
@@ -0,0 +1 @@
1
+ ce5bef6bfc675042e852ca3a0b8008841abe3f3e
data/.gita/config ADDED
@@ -0,0 +1,9 @@
1
+ [core]
2
+ repositoryformatversion = 0
3
+ filemode = true
4
+ bare = false
5
+ logallrefupdates = true
6
+ ignorecase = true
7
+ [remote "origin"]
8
+ url = git@github.com:godfat/dm-is-reflective.git
9
+ fetch = +refs/heads/*:refs/remotes/origin/*
data/.gita/description ADDED
@@ -0,0 +1 @@
1
+ Unnamed repository; edit this file to name it for gitweb.
data/.gita/gitk.cache ADDED
@@ -0,0 +1,6 @@
1
+ 1 4
2
+ 1ebf95ecf6e184d3169ea848fde72f9d15f7ae64 60d5de2444b94adc221f38c7707d792122067d96 {b2f24de5d89d74df621e11819f19ab8ba83c6478 6da2949c4c0ed511424bfc7469e0715040ec84e0 3701a55b6d70c3e8e983a8f8aeb8203459de4950 60d5de2444b94adc221f38c7707d792122067d96}
3
+ dc380fe987ce9da528b81dba6c5e2306d8b0b7c6 60d5de2444b94adc221f38c7707d792122067d96 60d5de2444b94adc221f38c7707d792122067d96
4
+ dc380fe987ce9da528b81dba6c5e2306d8b0b7c6 60d5de2444b94adc221f38c7707d792122067d96 {7b2dba1c4c86d9c1bc10798e365c422cc1999d75 60d5de2444b94adc221f38c7707d792122067d96}
5
+ 60d5de2444b94adc221f38c7707d792122067d96 2762f538b7daefd0e09fd4de151bee16e231c451 {b945064a265a580a5f88f6bd06cbbdd80badb472 0f042ee13eff5e7e672b2395f7a26e0a8f3f4ac6 1d72dbd72147b6d9509250e2e471298fcf03973e 1c88fa972f2ac9fcb6756cd29fee717d77b19d72 77bda6472cd95d1d3ca2c242cde290614aac2089 58023f029c5ddc004827f622bab84877f37d2ada 7dbb3eff9a347780efc26685b58ac5c2a9cda759 4a4bfc8216f5367cf63789f2adb84d9db0cd59e2 002ea8aea6145dfa9c494eb8028ab7fb6233d996 79db91d00105a0200ede5ede6a64d285ae907cf2 832cdd2ed11307a8fbea7440551775cf382f2596 7ae9dd3f0146bb4e0a431e3e2d0e89666741c3d4 df107a3c09969b48e59225b4beea02ca25a2d271 c61ac215503302c51555c3fba87941d84b4da01b 6c03205c38d90468b070f078e2d4cb6a0f8c45a9 d559b2102a6101d48d9f49eafa3d4aef9061be16 3db298d98c55c2a73d355dae47f446c0c9da37ba 3539a248157e651126ca9dc5a2a890d92459c98b 61e632164fba530e6364e756baf0d00b78538df5 9fc3c07359bf4601c11436a5999c811e9f710be3 96d4bf397fee7cecc3232b440c9bac92ab497306 f3ea86476b6f242c105735db38ac2021cf375797 c87eb23ab102203f336244381554ba01e25c2bf6 6e802fcbd15afc84ce303b4e59f60d7d47066809 e65a1d879c3e50b18363108f7fd3cb67daa45339 c0a6084eea63791e54fde12ddc7bc5f1b3196315 97f26f576b60dc88b7a619c38d32fcb4fd937c12 23c1e053b2786e6bec2c012c5d6f6572952305ec fe21da0c964f4efd46c0c3a31dc1502064f7b0c7 5aa9c3e95b5bc9cf1883679307a9943ada98fc71 0a73d9af4517b7c585364d7e17cd923aebb78384 8c0d208a02a9f521042e6de9ade6ef87de29723e f51cd1ce442e5f77d6a36abfdd27b63bdac7bc2a f2aadeef9f2e9a0aea8f63a7f45f63a233c0efd9 dd70fc571a69b734e3025aad9253dec6faf2c37b aa6c3689c38431671e5e6e6cf54fa09ebaa2fd7a 44c19de49ff25aa2a78dfe7e631a1cfc472c95d9 02dd039dc7599067975c3133f4320d76f2042902 b04d41127feef4aa5d54c3a6a9f56511d5f727b1 9d3fff64490482528f5be865c40847f4435f3293 fd3693e25e6bd33e934e4fdcd118eb8671cb11b3 8b57661de0e32ce3b9a5d02e47551014e36322cd 37b6081db3234fee5f8f2bc767c595038f390c15 02bb52da1b6364e33379ee71e148d1a810a2c3d7 2762f538b7daefd0e09fd4de151bee16e231c451}
6
+ 1
@@ -0,0 +1,15 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to check the commit log message taken by
4
+ # applypatch from an e-mail message.
5
+ #
6
+ # The hook should exit with non-zero status after issuing an
7
+ # appropriate message if it wants to stop the commit. The hook is
8
+ # allowed to edit the commit message file.
9
+ #
10
+ # To enable this hook, make this file executable.
11
+
12
+ . git-sh-setup
13
+ test -x "$GIT_DIR/hooks/commit-msg" &&
14
+ exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
15
+ :
@@ -0,0 +1,24 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to check the commit log message.
4
+ # Called by git-commit with one argument, the name of the file
5
+ # that has the commit message. The hook should exit with non-zero
6
+ # status after issuing an appropriate message if it wants to stop the
7
+ # commit. The hook is allowed to edit the commit message file.
8
+ #
9
+ # To enable this hook, make this file executable.
10
+
11
+ # Uncomment the below to add a Signed-off-by line to the message.
12
+ # Doing this in a hook is a bad idea in general, but the prepare-commit-msg
13
+ # hook is more suited to it.
14
+ #
15
+ # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
16
+ # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
17
+
18
+ # This example catches duplicate Signed-off-by lines.
19
+
20
+ test "" = "$(grep '^Signed-off-by: ' "$1" |
21
+ sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
22
+ echo >&2 Duplicate Signed-off-by lines.
23
+ exit 1
24
+ }
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script that is called after a successful
4
+ # commit is made.
5
+ #
6
+ # To enable this hook, make this file executable.
7
+
8
+ : Nothing
@@ -0,0 +1,16 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script for the post-receive event
4
+ #
5
+ # This script is run after receive-pack has accepted a pack and the
6
+ # repository has been updated. It is passed arguments in through stdin
7
+ # in the form
8
+ # <oldrev> <newrev> <refname>
9
+ # For example:
10
+ # aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
11
+ #
12
+ # see contrib/hooks/ for an sample, or uncomment the next line (on debian)
13
+ #
14
+
15
+
16
+ #. /usr/share/doc/git-core/contrib/hooks/post-receive-email
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to prepare a packed repository for use over
4
+ # dumb transports.
5
+ #
6
+ # To enable this hook, make this file executable by "chmod +x post-update".
7
+
8
+ exec git-update-server-info
@@ -0,0 +1,14 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to verify what is about to be committed
4
+ # by applypatch from an e-mail message.
5
+ #
6
+ # The hook should exit with non-zero status after issuing an
7
+ # appropriate message if it wants to stop the commit.
8
+ #
9
+ # To enable this hook, make this file executable.
10
+
11
+ . git-sh-setup
12
+ test -x "$GIT_DIR/hooks/pre-commit" &&
13
+ exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
14
+ :
@@ -0,0 +1,70 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to verify what is about to be committed.
4
+ # Called by git-commit with no arguments. The hook should
5
+ # exit with non-zero status after issuing an appropriate message if
6
+ # it wants to stop the commit.
7
+ #
8
+ # To enable this hook, make this file executable.
9
+
10
+ # This is slightly modified from Andrew Morton's Perfect Patch.
11
+ # Lines you introduce should not have trailing whitespace.
12
+ # Also check for an indentation that has SP before a TAB.
13
+
14
+ if git-rev-parse --verify HEAD 2>/dev/null
15
+ then
16
+ git-diff-index -p -M --cached HEAD --
17
+ else
18
+ # NEEDSWORK: we should produce a diff with an empty tree here
19
+ # if we want to do the same verification for the initial import.
20
+ :
21
+ fi |
22
+ perl -e '
23
+ my $found_bad = 0;
24
+ my $filename;
25
+ my $reported_filename = "";
26
+ my $lineno;
27
+ sub bad_line {
28
+ my ($why, $line) = @_;
29
+ if (!$found_bad) {
30
+ print STDERR "*\n";
31
+ print STDERR "* You have some suspicious patch lines:\n";
32
+ print STDERR "*\n";
33
+ $found_bad = 1;
34
+ }
35
+ if ($reported_filename ne $filename) {
36
+ print STDERR "* In $filename\n";
37
+ $reported_filename = $filename;
38
+ }
39
+ print STDERR "* $why (line $lineno)\n";
40
+ print STDERR "$filename:$lineno:$line\n";
41
+ }
42
+ while (<>) {
43
+ if (m|^diff --git a/(.*) b/\1$|) {
44
+ $filename = $1;
45
+ next;
46
+ }
47
+ if (/^@@ -\S+ \+(\d+)/) {
48
+ $lineno = $1 - 1;
49
+ next;
50
+ }
51
+ if (/^ /) {
52
+ $lineno++;
53
+ next;
54
+ }
55
+ if (s/^\+//) {
56
+ $lineno++;
57
+ chomp;
58
+ if (/\s$/) {
59
+ bad_line("trailing whitespace", $_);
60
+ }
61
+ if (/^\s* \t/) {
62
+ bad_line("indent SP followed by a TAB", $_);
63
+ }
64
+ if (/^([<>])\1{6} |^={7}$/) {
65
+ bad_line("unresolved merge conflict", $_);
66
+ }
67
+ }
68
+ }
69
+ exit($found_bad);
70
+ '
@@ -0,0 +1,150 @@
1
+ #!/bin/sh
2
+ #
3
+ # Copyright (c) 2006 Junio C Hamano
4
+ #
5
+
6
+ publish=next
7
+ basebranch="$1"
8
+ if test "$#" = 2
9
+ then
10
+ topic="refs/heads/$2"
11
+ else
12
+ topic=`git symbolic-ref HEAD`
13
+ fi
14
+
15
+ case "$basebranch,$topic" in
16
+ master,refs/heads/??/*)
17
+ ;;
18
+ *)
19
+ exit 0 ;# we do not interrupt others.
20
+ ;;
21
+ esac
22
+
23
+ # Now we are dealing with a topic branch being rebased
24
+ # on top of master. Is it OK to rebase it?
25
+
26
+ # Is topic fully merged to master?
27
+ not_in_master=`git-rev-list --pretty=oneline ^master "$topic"`
28
+ if test -z "$not_in_master"
29
+ then
30
+ echo >&2 "$topic is fully merged to master; better remove it."
31
+ exit 1 ;# we could allow it, but there is no point.
32
+ fi
33
+
34
+ # Is topic ever merged to next? If so you should not be rebasing it.
35
+ only_next_1=`git-rev-list ^master "^$topic" ${publish} | sort`
36
+ only_next_2=`git-rev-list ^master ${publish} | sort`
37
+ if test "$only_next_1" = "$only_next_2"
38
+ then
39
+ not_in_topic=`git-rev-list "^$topic" master`
40
+ if test -z "$not_in_topic"
41
+ then
42
+ echo >&2 "$topic is already up-to-date with master"
43
+ exit 1 ;# we could allow it, but there is no point.
44
+ else
45
+ exit 0
46
+ fi
47
+ else
48
+ not_in_next=`git-rev-list --pretty=oneline ^${publish} "$topic"`
49
+ perl -e '
50
+ my $topic = $ARGV[0];
51
+ my $msg = "* $topic has commits already merged to public branch:\n";
52
+ my (%not_in_next) = map {
53
+ /^([0-9a-f]+) /;
54
+ ($1 => 1);
55
+ } split(/\n/, $ARGV[1]);
56
+ for my $elem (map {
57
+ /^([0-9a-f]+) (.*)$/;
58
+ [$1 => $2];
59
+ } split(/\n/, $ARGV[2])) {
60
+ if (!exists $not_in_next{$elem->[0]}) {
61
+ if ($msg) {
62
+ print STDERR $msg;
63
+ undef $msg;
64
+ }
65
+ print STDERR " $elem->[1]\n";
66
+ }
67
+ }
68
+ ' "$topic" "$not_in_next" "$not_in_master"
69
+ exit 1
70
+ fi
71
+
72
+ exit 0
73
+
74
+ ################################################################
75
+
76
+ This sample hook safeguards topic branches that have been
77
+ published from being rewound.
78
+
79
+ The workflow assumed here is:
80
+
81
+ * Once a topic branch forks from "master", "master" is never
82
+ merged into it again (either directly or indirectly).
83
+
84
+ * Once a topic branch is fully cooked and merged into "master",
85
+ it is deleted. If you need to build on top of it to correct
86
+ earlier mistakes, a new topic branch is created by forking at
87
+ the tip of the "master". This is not strictly necessary, but
88
+ it makes it easier to keep your history simple.
89
+
90
+ * Whenever you need to test or publish your changes to topic
91
+ branches, merge them into "next" branch.
92
+
93
+ The script, being an example, hardcodes the publish branch name
94
+ to be "next", but it is trivial to make it configurable via
95
+ $GIT_DIR/config mechanism.
96
+
97
+ With this workflow, you would want to know:
98
+
99
+ (1) ... if a topic branch has ever been merged to "next". Young
100
+ topic branches can have stupid mistakes you would rather
101
+ clean up before publishing, and things that have not been
102
+ merged into other branches can be easily rebased without
103
+ affecting other people. But once it is published, you would
104
+ not want to rewind it.
105
+
106
+ (2) ... if a topic branch has been fully merged to "master".
107
+ Then you can delete it. More importantly, you should not
108
+ build on top of it -- other people may already want to
109
+ change things related to the topic as patches against your
110
+ "master", so if you need further changes, it is better to
111
+ fork the topic (perhaps with the same name) afresh from the
112
+ tip of "master".
113
+
114
+ Let's look at this example:
115
+
116
+ o---o---o---o---o---o---o---o---o---o "next"
117
+ / / / /
118
+ / a---a---b A / /
119
+ / / / /
120
+ / / c---c---c---c B /
121
+ / / / \ /
122
+ / / / b---b C \ /
123
+ / / / / \ /
124
+ ---o---o---o---o---o---o---o---o---o---o---o "master"
125
+
126
+
127
+ A, B and C are topic branches.
128
+
129
+ * A has one fix since it was merged up to "next".
130
+
131
+ * B has finished. It has been fully merged up to "master" and "next",
132
+ and is ready to be deleted.
133
+
134
+ * C has not merged to "next" at all.
135
+
136
+ We would want to allow C to be rebased, refuse A, and encourage
137
+ B to be deleted.
138
+
139
+ To compute (1):
140
+
141
+ git-rev-list ^master ^topic next
142
+ git-rev-list ^master next
143
+
144
+ if these match, topic has not merged in next at all.
145
+
146
+ To compute (2):
147
+
148
+ git-rev-list master..topic
149
+
150
+ if this is empty, it is fully merged to "master".
@@ -0,0 +1,36 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to prepare the commit log message.
4
+ # Called by git-commit with the name of the file that has the
5
+ # commit message, followed by the description of the commit
6
+ # message's source. The hook's purpose is to edit the commit
7
+ # message file. If the hook fails with a non-zero status,
8
+ # the commit is aborted.
9
+ #
10
+ # To enable this hook, make this file executable.
11
+
12
+ # This hook includes three examples. The first comments out the
13
+ # "Conflicts:" part of a merge commit.
14
+ #
15
+ # The second includes the output of "git diff --name-status -r"
16
+ # into the message, just before the "git status" output. It is
17
+ # commented because it doesn't cope with --amend or with squashed
18
+ # commits.
19
+ #
20
+ # The third example adds a Signed-off-by line to the message, that can
21
+ # still be edited. This is rarely a good idea.
22
+
23
+ case "$2,$3" in
24
+ merge,)
25
+ perl -i -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
26
+
27
+ # ,|template,)
28
+ # perl -i -pe '
29
+ # print "\n" . `git diff --cached --name-status -r`
30
+ # if /^#/ && $first++ == 0' "$1" ;;
31
+
32
+ *) ;;
33
+ esac
34
+
35
+ # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
36
+ # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
@@ -0,0 +1,107 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to blocks unannotated tags from entering.
4
+ # Called by git-receive-pack with arguments: refname sha1-old sha1-new
5
+ #
6
+ # To enable this hook, make this file executable by "chmod +x update".
7
+ #
8
+ # Config
9
+ # ------
10
+ # hooks.allowunannotated
11
+ # This boolean sets whether unannotated tags will be allowed into the
12
+ # repository. By default they won't be.
13
+ # hooks.allowdeletetag
14
+ # This boolean sets whether deleting tags will be allowed in the
15
+ # repository. By default they won't be.
16
+ # hooks.allowdeletebranch
17
+ # This boolean sets whether deleting branches will be allowed in the
18
+ # repository. By default they won't be.
19
+ #
20
+
21
+ # --- Command line
22
+ refname="$1"
23
+ oldrev="$2"
24
+ newrev="$3"
25
+
26
+ # --- Safety check
27
+ if [ -z "$GIT_DIR" ]; then
28
+ echo "Don't run this script from the command line." >&2
29
+ echo " (if you want, you could supply GIT_DIR then run" >&2
30
+ echo " $0 <ref> <oldrev> <newrev>)" >&2
31
+ exit 1
32
+ fi
33
+
34
+ if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
35
+ echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
36
+ exit 1
37
+ fi
38
+
39
+ # --- Config
40
+ allowunannotated=$(git config --bool hooks.allowunannotated)
41
+ allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
42
+ allowdeletetag=$(git config --bool hooks.allowdeletetag)
43
+
44
+ # check for no description
45
+ projectdesc=$(sed -e '1q' "$GIT_DIR/description")
46
+ if [ -z "$projectdesc" -o "$projectdesc" = "Unnamed repository; edit this file to name it for gitweb." ]; then
47
+ echo "*** Project description file hasn't been set" >&2
48
+ exit 1
49
+ fi
50
+
51
+ # --- Check types
52
+ # if $newrev is 0000...0000, it's a commit to delete a ref.
53
+ if [ "$newrev" = "0000000000000000000000000000000000000000" ]; then
54
+ newrev_type=delete
55
+ else
56
+ newrev_type=$(git-cat-file -t $newrev)
57
+ fi
58
+
59
+ case "$refname","$newrev_type" in
60
+ refs/tags/*,commit)
61
+ # un-annotated tag
62
+ short_refname=${refname##refs/tags/}
63
+ if [ "$allowunannotated" != "true" ]; then
64
+ echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
65
+ echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
66
+ exit 1
67
+ fi
68
+ ;;
69
+ refs/tags/*,delete)
70
+ # delete tag
71
+ if [ "$allowdeletetag" != "true" ]; then
72
+ echo "*** Deleting a tag is not allowed in this repository" >&2
73
+ exit 1
74
+ fi
75
+ ;;
76
+ refs/tags/*,tag)
77
+ # annotated tag
78
+ ;;
79
+ refs/heads/*,commit)
80
+ # branch
81
+ ;;
82
+ refs/heads/*,delete)
83
+ # delete branch
84
+ if [ "$allowdeletebranch" != "true" ]; then
85
+ echo "*** Deleting a branch is not allowed in this repository" >&2
86
+ exit 1
87
+ fi
88
+ ;;
89
+ refs/remotes/*,commit)
90
+ # tracking branch
91
+ ;;
92
+ refs/remotes/*,delete)
93
+ # delete tracking branch
94
+ if [ "$allowdeletebranch" != "true" ]; then
95
+ echo "*** Deleting a tracking branch is not allowed in this repository" >&2
96
+ exit 1
97
+ fi
98
+ ;;
99
+ *)
100
+ # Anything else (is there anything else?)
101
+ echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
102
+ exit 1
103
+ ;;
104
+ esac
105
+
106
+ # --- Finished
107
+ exit 0