multibyte 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. data/.git/COMMIT_EDITMSG +57 -0
  2. data/.git/HEAD +1 -0
  3. data/.git/config +8 -0
  4. data/.git/description +1 -0
  5. data/.git/hooks/applypatch-msg +15 -0
  6. data/.git/hooks/commit-msg +21 -0
  7. data/.git/hooks/post-commit +8 -0
  8. data/.git/hooks/post-receive +16 -0
  9. data/.git/hooks/post-update +8 -0
  10. data/.git/hooks/pre-applypatch +14 -0
  11. data/.git/hooks/pre-commit +70 -0
  12. data/.git/hooks/pre-rebase +150 -0
  13. data/.git/hooks/update +107 -0
  14. data/.git/index +0 -0
  15. data/.git/info/exclude +6 -0
  16. data/.git/logs/HEAD +4 -0
  17. data/.git/logs/refs/heads/master +4 -0
  18. data/.git/logs/refs/remotes/origin/master +3 -0
  19. data/.git/objects/02/e9a792fa31b00f0f06012e0b5e3ef327c40f64 +0 -0
  20. data/.git/objects/10/0b93820ade4c16225673b4ca62bb3ade63c313 +0 -0
  21. data/.git/objects/10/aab6490174970a2349d1050882c644f8d07006 +7 -0
  22. data/.git/objects/11/cda2eaac1ae103a13bf835456de05f53b0c8ad +0 -0
  23. data/.git/objects/1d/61c71cd5cf0f4dae6305b007a6177e1cecd7ea +0 -0
  24. data/.git/objects/2c/84cd00c156ba3b46e733c7e34dd9aea0c4fa75 +0 -0
  25. data/.git/objects/2f/3a16e4a756ec7a2d32c4bd8386b855f41cae61 +0 -0
  26. data/.git/objects/2f/437425b2c085bb529379e409d6b4bc7f9f9fba +0 -0
  27. data/.git/objects/3f/9afe5eaf00ad4d2ffa2e9315b96f530b0e85d4 +2 -0
  28. data/.git/objects/42/4a5f37c6fe3a7cac54b0f85688c1cce7da9cdf +0 -0
  29. data/.git/objects/47/26f03dc598a372cb959e3cbe33334de70802fd +0 -0
  30. data/.git/objects/55/37e6b2a449fe6d6c800803d0f72ffbcf44c297 +0 -0
  31. data/.git/objects/64/334b80d5fcead16f13cb8b7a45120ea460747b +0 -0
  32. data/.git/objects/69/1ed3b65603a0d0dabfb66720e7163664be78f5 +0 -0
  33. data/.git/objects/72/141584a5836168fe912ebce5b4537bd0eafc09 +1 -0
  34. data/.git/objects/7c/e872bc55ff766e542d2fbbe00e9dde70baaa92 +2 -0
  35. data/.git/objects/93/e03faa6906892434fa9f2ad230c4ececc64055 +0 -0
  36. data/.git/objects/9d/c9a787700bafb70e1833a760b73dec26a6a56e +0 -0
  37. data/.git/objects/9f/672edccfaaa00b6584f599c3e68560e6a5bedf +0 -0
  38. data/.git/objects/ab/1cd78b02ec268ce7d2faf4b1692f4bed9273fe +0 -0
  39. data/.git/objects/ad/8866bd33ae1afe9278cf5ee833d71977af561c +0 -0
  40. data/.git/objects/af/c3ea327fa220ee42a5ebecfcc7d218be4ea1d9 +0 -0
  41. data/.git/objects/b2/56d1cf3a9ba99f308daf1b4cd0dd08f11448e0 +1 -0
  42. data/.git/objects/bc/184b885eca1bed875171bd3990433055dda3af +0 -0
  43. data/.git/objects/c2/7f6559350f7adb19d43742b55b2f91d07b6550 +0 -0
  44. data/.git/objects/c3/e7364c6e90fb80e979779cd822bc8cdc8a3790 +0 -0
  45. data/.git/objects/c9/5128ff8f94e949d796afa128f2f341ba69989c +0 -0
  46. data/.git/objects/ce/e1f5b453e86a5aa913c626641608839bb79eef +1 -0
  47. data/.git/objects/cf/6add7ea568d3d90d6a1f8afb0898b0119b14ff +0 -0
  48. data/.git/objects/d5/e18b1fd7b189fdc75dd3bc4d208323cbc01aa8 +0 -0
  49. data/.git/objects/de/6e40dc4d92c1a889f8581718a48f2fcd219442 +0 -0
  50. data/.git/objects/df/42782d610e8c714f78cf0a018c600667da795e +0 -0
  51. data/.git/objects/e0/65ff01f0883142d4901a371be8dc60998fbe04 +4 -0
  52. data/.git/objects/e1/ad06969c3d3982b06ebd7da3777a0926501e7c +0 -0
  53. data/.git/objects/e4/69154c2ae4c3c596870a5e920f197b7b5be179 +2 -0
  54. data/.git/objects/e4/8464df56bf487e96e21ea99487330266dae3c9 +0 -0
  55. data/.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
  56. data/.git/objects/e8/517350dbaadcb01282282218638c6022a20091 +0 -0
  57. data/.git/objects/eb/1bffe6adda4dc202d219cb35fe142a5e42b46b +0 -0
  58. data/.git/objects/eb/5d1c06d3a469df91dff68022b3b179e30cd127 +0 -0
  59. data/.git/objects/ec/f2f7e20cd14b0d4b5c0b7d0450aafc8c4f7066 +0 -0
  60. data/.git/objects/f1/ca0626d3e5dfcf88df23c9720d6f770fcbef73 +0 -0
  61. data/.git/objects/f2/3c73e1110a2fec82d37a1a399b9f274d30f0fe +0 -0
  62. data/.git/objects/f2/aec2820bf2f1c87c031d4abe262560392ac4b9 +0 -0
  63. data/.git/objects/f8/73dae66e0208669dbf74718181b3866647f426 +0 -0
  64. data/.git/refs/heads/master +1 -0
  65. data/.git/refs/remotes/origin/master +1 -0
  66. data/History.txt +4 -0
  67. data/License.txt +20 -0
  68. data/Manifest.txt +97 -0
  69. data/README.txt +19 -0
  70. data/Rakefile +4 -0
  71. data/config/hoe.rb +70 -0
  72. data/config/requirements.rb +17 -0
  73. data/lib/multibyte/chars.rb +135 -0
  74. data/lib/multibyte/generators/generate_tables.rb +145 -0
  75. data/lib/multibyte/handlers/passthru_handler.rb +9 -0
  76. data/lib/multibyte/handlers/utf8_handler.rb +564 -0
  77. data/lib/multibyte/handlers/utf8_handler_proc.rb +43 -0
  78. data/lib/multibyte/version.rb +9 -0
  79. data/lib/multibyte.rb +15 -0
  80. data/lib/unicode.rb +66 -0
  81. data/log/debug.log +0 -0
  82. data/script/destroy +14 -0
  83. data/script/generate +14 -0
  84. data/script/txt2html +74 -0
  85. data/setup.rb +1585 -0
  86. data/spec/multibyte_spec.rb +11 -0
  87. data/spec/spec.opts +1 -0
  88. data/spec/spec_helper.rb +7 -0
  89. data/tasks/deployment.rake +34 -0
  90. data/tasks/environment.rake +7 -0
  91. data/tasks/rspec.rake +21 -0
  92. data/tasks/website.rake +17 -0
  93. data/website/index.html +11 -0
  94. data/website/index.txt +39 -0
  95. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  96. data/website/stylesheets/screen.css +138 -0
  97. data/website/template.rhtml +48 -0
  98. data.tar.gz.sig +3 -0
  99. metadata +176 -0
  100. metadata.gz.sig +0 -0
@@ -0,0 +1,57 @@
1
+ added readme + github gemspec
2
+ # Please enter the commit message for your changes.
3
+ # (Comment lines starting with '#' will not be included)
4
+ # On branch master
5
+ # Changes to be committed:
6
+ # (use "git reset HEAD <file>..." to unstage)
7
+ #
8
+ # modified: README.txt
9
+ # new file: multibyte.gemspec
10
+ #
11
+ # Untracked files:
12
+ # (use "git add <file>..." to include in what will be committed)
13
+ #
14
+ # pkg/
15
+ diff --git a/README.txt b/README.txt
16
+ index f5d4529..6dc9b45 100644
17
+ --- a/README.txt
18
+ +++ b/README.txt
19
+ @@ -12,3 +12,8 @@ Usage
20
+ => #<Multibyte::Chars:0x127e3d0 @string="新通">
21
+ >> "新通訊錄".chars[0..1].to_s
22
+ => "新通"
23
+ +
24
+ +Installation:
25
+ +=============
26
+ +
27
+ +$ sudo gem install matta-multibyte --source=http://gems.github.com
28
+ diff --git a/multibyte.gemspec b/multibyte.gemspec
29
+ new file mode 100644
30
+ index 0000000..856cabc
31
+ --- /dev/null
32
+ +++ b/multibyte.gemspec
33
+ @@ -0,0 +1,23 @@
34
+ +Gem::Specification.new do |s|
35
+ + s.name = %q{multibyte}
36
+ + s.version = "0.0.1"
37
+ +
38
+ + s.specification_version = 2 if s.respond_to? :specification_version=
39
+ +
40
+ + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
41
+ + s.authors = ["Matt Aimonetti"]
42
+ + s.cert_chain = ["/Users/matta/.gem/gem-public_cert.pem"]
43
+ + s.date = %q{2008-05-28}
44
+ + s.description = %q{Multibyte support for Ruby}
45
+ + s.email = ["mattaimonetti@gmail.com"]
46
+ + s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "website/index.txt"]
47
+ + s.files = ["History.txt", "License.txt", "Manifest.txt", "README.txt", "Rakefile", "config/hoe.rb", "config/requirements.rb", "lib/multibyte.rb", "lib/multibyte/chars.rb", "lib/multibyte/generators/generate_tables.rb", "lib/multibyte/handlers/passthru_handler.rb", "lib/multibyte/handlers/utf8_handler.rb", "lib/multibyte/handlers/utf8_handler_proc.rb", "lib/multibyte/version.rb", "lib/unicode.rb", "log/debug.log", "script/destroy", "script/generate", "script/txt2html", "setup.rb", "spec/multibyte_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/deployment.rake", "tasks/environment.rake", "tasks/rspec.rake", "tasks/website.rake"]
48
+ + s.has_rdoc = true
49
+ + s.homepage = %q{http://multibyte.rubyforge.org}
50
+ + s.rdoc_options = ["--main", "README.txt"]
51
+ + s.require_paths = ["lib"]
52
+ + s.rubyforge_project = %q{multibyte}
53
+ + s.rubygems_version = %q{1.1.1}
54
+ + s.signing_key = %q{/Users/matta/.gem/gem-private_key.pem}
55
+ + s.summary = %q{Multibyte support for Ruby}
56
+ +end
57
+
data/.git/HEAD ADDED
@@ -0,0 +1 @@
1
+ ref: refs/heads/master
data/.git/config ADDED
@@ -0,0 +1,8 @@
1
+ [core]
2
+ repositoryformatversion = 0
3
+ filemode = true
4
+ bare = false
5
+ logallrefupdates = true
6
+ [remote "origin"]
7
+ url = git@github.com:matta/multibyte.git
8
+ fetch = +refs/heads/*:refs/remotes/origin/*
data/.git/description ADDED
@@ -0,0 +1 @@
1
+ Unnamed repository; edit this file to name it for gitweb.
@@ -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,21 @@
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
+ # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
13
+ # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
14
+
15
+ # This example catches duplicate Signed-off-by lines.
16
+
17
+ test "" = "$(grep '^Signed-off-by: ' "$1" |
18
+ sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
19
+ echo >&2 Duplicate Signed-off-by lines.
20
+ exit 1
21
+ }
@@ -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".
data/.git/hooks/update ADDED
@@ -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