| Hash | Commit message | Author | Date | Files | + | - |
1 | commit 7f5f68849e66e747804e81a365291886f96e88fd |
2 | Author: Connor Etherington <[email protected]> |
3 | Date: Sun Jan 28 00:20:55 2024 +0200 |
4 | |
5 | Auto-Commit Update - 20240128 |
6 | --- |
7 | BUILD/PKGBUILD | 28 + |
8 | BUILD/dict-0.1.0-1-any.pkg.tar.zst | Bin 0 -> 24615 bytes |
9 | BUILD/dict-0.1.0-1-any.pkg.tar.zst.sig | Bin 0 -> 566 bytes |
10 | BUILD/dict.install | 15 + |
11 | BUILD/dict/HEAD | 1 + |
12 | BUILD/dict/config | 8 + |
13 | BUILD/dict/description | 1 + |
14 | BUILD/dict/hooks/applypatch-msg.sample | 15 + |
15 | BUILD/dict/hooks/commit-msg.sample | 24 + |
16 | BUILD/dict/hooks/fsmonitor-watchman.sample | 174 ++ |
17 | BUILD/dict/hooks/post-update.sample | 8 + |
18 | BUILD/dict/hooks/pre-applypatch.sample | 14 + |
19 | BUILD/dict/hooks/pre-commit.sample | 49 + |
20 | BUILD/dict/hooks/pre-merge-commit.sample | 13 + |
21 | BUILD/dict/hooks/pre-push.sample | 53 + |
22 | BUILD/dict/hooks/pre-rebase.sample | 169 ++ |
23 | BUILD/dict/hooks/pre-receive.sample | 24 + |
24 | BUILD/dict/hooks/prepare-commit-msg.sample | 42 + |
25 | BUILD/dict/hooks/push-to-checkout.sample | 78 + |
26 | BUILD/dict/hooks/sendemail-validate.sample | 77 + |
27 | BUILD/dict/hooks/update.sample | 128 ++ |
28 | BUILD/dict/info/exclude | 6 + |
29 | ...ck-fc2d1048db3cecf39d460070bad5d2d410b361b0.idx | Bin 0 -> 1688 bytes |
30 | ...k-fc2d1048db3cecf39d460070bad5d2d410b361b0.pack | Bin 0 -> 10967 bytes |
31 | ...ck-fc2d1048db3cecf39d460070bad5d2d410b361b0.rev | Bin 0 -> 140 bytes |
32 | BUILD/dict/packed-refs | 2 + |
33 | BUILD/pkg/dict/.BUILDINFO | 2384 ++++++++++++++++++++ |
34 | BUILD/pkg/dict/.INSTALL | 15 + |
35 | BUILD/pkg/dict/.MTREE | Bin 0 -> 451 bytes |
36 | BUILD/pkg/dict/.PKGINFO | 14 + |
37 | BUILD/pkg/dict/usr/share/licenses/dict/LICENSE | 28 + |
38 | BUILD/src/dict | 1 + |
39 | PKGBUILD | 4 + |
40 | 33 files changed, 3375 insertions(+) |
41 | |
42 | diff --git a/BUILD/PKGBUILD b/BUILD/PKGBUILD |
43 | new file mode 100644 |
44 | index 0000000..049e60f |
45 | --- /dev/null |
46 | +++ b/BUILD/PKGBUILD |
47 | @@ -0,0 +1,28 @@ |
48 | +# Maintainer: Connor Etherington <[email protected]> |
49 | +# --- |
50 | +pkgname=dict |
51 | +pkgver=0.1.0 |
52 | +pkgrel=1 |
53 | +pkgdesc="An easy to use english dictionary for the command line." |
54 | +arch=(any) |
55 | +url="https://gitlab.com/a4to/${pkgname}" |
56 | +license=('MIT') |
57 | +install="${pkgname}.install" |
58 | +depends=('nodejs' 'npm') |
59 | +source=("git+$url.git") |
60 | +sha256sums=('SKIP') |
61 | + |
62 | +package() { |
63 | + |
64 | + [ -d "${srcdir}/${pkgname}-${pkgver}-${pkgrel}-${arch}/usr/lib/node_modules/${pkgname}" ] && |
65 | + cd "${srcdir}/${pkgname}-${pkgver}-${pkgrel}-${arch}/usr/lib/node_modules/${pkgname}" || |
66 | + cd "${srcdir}/${pkgname}/usr/lib/node_modules/${pkgname}" |
67 | + |
68 | + which yarn >/dev/null 2>&1 && yarn install || npm install |
69 | + cp -ar ${srcdir}/${pkgname}/usr/lib/node_modules/${pkgname}/* "${pkgdir}"/usr/lib/node_modules/${pkgname} 2>/dev/null & installed=$?; |
70 | + [ $installed -eq 0 ] || cp -ar ${srcdir}/usr/lib/node_modules/${pkgname}/* "${pkgdir}"/usr/lib/node_modules/${pkgname} |
71 | + |
72 | + install -Dm644 ${srcdir}/${pkgname}/usr/share/licenses/${pkgname}/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" 2>/dev/null || |
73 | + install -Dm644 ${srcdir}/usr/share/licenses/${pkgname}/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" |
74 | + |
75 | +} |
76 | diff --git a/BUILD/dict-0.1.0-1-any.pkg.tar.zst b/BUILD/dict-0.1.0-1-any.pkg.tar.zst |
77 | new file mode 100644 |
78 | index 0000000..75fbf76 |
79 | Binary files /dev/null and b/BUILD/dict-0.1.0-1-any.pkg.tar.zst differ |
80 | diff --git a/BUILD/dict-0.1.0-1-any.pkg.tar.zst.sig b/BUILD/dict-0.1.0-1-any.pkg.tar.zst.sig |
81 | new file mode 100644 |
82 | index 0000000..2ddb6fb |
83 | Binary files /dev/null and b/BUILD/dict-0.1.0-1-any.pkg.tar.zst.sig differ |
84 | diff --git a/BUILD/dict.install b/BUILD/dict.install |
85 | new file mode 100644 |
86 | index 0000000..48736bb |
87 | --- /dev/null |
88 | +++ b/BUILD/dict.install |
89 | @@ -0,0 +1,15 @@ |
90 | +post_install(){ |
91 | + cd /usr/lib/node_modules/dict |
92 | + which yarn >/dev/null 2>&1 && yarn install || npm install |
93 | + echo -e "\n[32;1m[+] [0;1mThank you for using dict!\n" |
94 | +} |
95 | + |
96 | +post_upgrade(){ |
97 | + cd /usr/lib/node_modules/dict |
98 | + which yarn >/dev/null 2>&1 && yarn install || npm install |
99 | +} |
100 | + |
101 | +pre_remove(){ |
102 | + rm -rf /usr/lib/node_modules/dict |
103 | +} |
104 | + |
105 | diff --git a/BUILD/dict/HEAD b/BUILD/dict/HEAD |
106 | new file mode 100644 |
107 | index 0000000..cb089cd |
108 | --- /dev/null |
109 | +++ b/BUILD/dict/HEAD |
110 | @@ -0,0 +1 @@ |
111 | +ref: refs/heads/master |
112 | diff --git a/BUILD/dict/config b/BUILD/dict/config |
113 | new file mode 100644 |
114 | index 0000000..23422d6 |
115 | --- /dev/null |
116 | +++ b/BUILD/dict/config |
117 | @@ -0,0 +1,8 @@ |
118 | +[core] |
119 | + repositoryformatversion = 0 |
120 | + filemode = true |
121 | + bare = true |
122 | +[remote "origin"] |
123 | + url = https://gitlab.com/a4to/dict.git |
124 | + fetch = +refs/*:refs/* |
125 | + mirror = true |
126 | diff --git a/BUILD/dict/description b/BUILD/dict/description |
127 | new file mode 100644 |
128 | index 0000000..498b267 |
129 | --- /dev/null |
130 | +++ b/BUILD/dict/description |
131 | @@ -0,0 +1 @@ |
132 | +Unnamed repository; edit this file 'description' to name the repository. |
133 | diff --git a/BUILD/dict/hooks/applypatch-msg.sample b/BUILD/dict/hooks/applypatch-msg.sample |
134 | new file mode 100755 |
135 | index 0000000..a5d7b84 |
136 | --- /dev/null |
137 | +++ b/BUILD/dict/hooks/applypatch-msg.sample |
138 | @@ -0,0 +1,15 @@ |
139 | +#!/bin/sh |
140 | +# |
141 | +# An example hook script to check the commit log message taken by |
142 | +# applypatch from an e-mail message. |
143 | +# |
144 | +# The hook should exit with non-zero status after issuing an |
145 | +# appropriate message if it wants to stop the commit. The hook is |
146 | +# allowed to edit the commit message file. |
147 | +# |
148 | +# To enable this hook, rename this file to "applypatch-msg". |
149 | + |
150 | +. git-sh-setup |
151 | +commitmsg="$(git rev-parse --git-path hooks/commit-msg)" |
152 | +test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} |
153 | +: |
154 | diff --git a/BUILD/dict/hooks/commit-msg.sample b/BUILD/dict/hooks/commit-msg.sample |
155 | new file mode 100755 |
156 | index 0000000..b58d118 |
157 | --- /dev/null |
158 | +++ b/BUILD/dict/hooks/commit-msg.sample |
159 | @@ -0,0 +1,24 @@ |
160 | +#!/bin/sh |
161 | +# |
162 | +# An example hook script to check the commit log message. |
163 | +# Called by "git commit" with one argument, the name of the file |
164 | +# that has the commit message. The hook should exit with non-zero |
165 | +# status after issuing an appropriate message if it wants to stop the |
166 | +# commit. The hook is allowed to edit the commit message file. |
167 | +# |
168 | +# To enable this hook, rename this file to "commit-msg". |
169 | + |
170 | +# Uncomment the below to add a Signed-off-by line to the message. |
171 | +# Doing this in a hook is a bad idea in general, but the prepare-commit-msg |
172 | +# hook is more suited to it. |
173 | +# |
174 | +# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') |
175 | +# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" |
176 | + |
177 | +# This example catches duplicate Signed-off-by lines. |
178 | + |
179 | +test "" = "$(grep '^Signed-off-by: ' "$1" | |
180 | + sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { |
181 | + echo >&2 Duplicate Signed-off-by lines. |
182 | + exit 1 |
183 | +} |
184 | diff --git a/BUILD/dict/hooks/fsmonitor-watchman.sample b/BUILD/dict/hooks/fsmonitor-watchman.sample |
185 | new file mode 100755 |
186 | index 0000000..23e856f |
187 | --- /dev/null |
188 | +++ b/BUILD/dict/hooks/fsmonitor-watchman.sample |
189 | @@ -0,0 +1,174 @@ |
190 | +#!/usr/bin/perl |
191 | + |
192 | +use strict; |
193 | +use warnings; |
194 | +use IPC::Open2; |
195 | + |
196 | +# An example hook script to integrate Watchman |
197 | +# (https://facebook.github.io/watchman/) with git to speed up detecting |
198 | +# new and modified files. |
199 | +# |
200 | +# The hook is passed a version (currently 2) and last update token |
201 | +# formatted as a string and outputs to stdout a new update token and |
202 | +# all files that have been modified since the update token. Paths must |
203 | +# be relative to the root of the working tree and separated by a single NUL. |
204 | +# |
205 | +# To enable this hook, rename this file to "query-watchman" and set |
206 | +# 'git config core.fsmonitor .git/hooks/query-watchman' |
207 | +# |
208 | +my ($version, $last_update_token) = @ARGV; |
209 | + |
210 | +# Uncomment for debugging |
211 | +# print STDERR "$0 $version $last_update_token\n"; |
212 | + |
213 | +# Check the hook interface version |
214 | +if ($version ne 2) { |
215 | + die "Unsupported query-fsmonitor hook version '$version'.\n" . |
216 | + "Falling back to scanning...\n"; |
217 | +} |
218 | + |
219 | +my $git_work_tree = get_working_dir(); |
220 | + |
221 | +my $retry = 1; |
222 | + |
223 | +my $json_pkg; |
224 | +eval { |
225 | + require JSON::XS; |
226 | + $json_pkg = "JSON::XS"; |
227 | + 1; |
228 | +} or do { |
229 | + require JSON::PP; |
230 | + $json_pkg = "JSON::PP"; |
231 | +}; |
232 | + |
233 | +launch_watchman(); |
234 | + |
235 | +sub launch_watchman { |
236 | + my $o = watchman_query(); |
237 | + if (is_work_tree_watched($o)) { |
238 | + output_result($o->{clock}, @{$o->{files}}); |
239 | + } |
240 | +} |
241 | + |
242 | +sub output_result { |
243 | + my ($clockid, @files) = @_; |
244 | + |
245 | + # Uncomment for debugging watchman output |
246 | + # open (my $fh, ">", ".git/watchman-output.out"); |
247 | + # binmode $fh, ":utf8"; |
248 | + # print $fh "$clockid\n@files\n"; |
249 | + # close $fh; |
250 | + |
251 | + binmode STDOUT, ":utf8"; |
252 | + print $clockid; |
253 | + print "\0"; |
254 | + local $, = "\0"; |
255 | + print @files; |
256 | +} |
257 | + |
258 | +sub watchman_clock { |
259 | + my $response = qx/watchman clock "$git_work_tree"/; |
260 | + die "Failed to get clock id on '$git_work_tree'.\n" . |
261 | + "Falling back to scanning...\n" if $? != 0; |
262 | + |
263 | + return $json_pkg->new->utf8->decode($response); |
264 | +} |
265 | + |
266 | +sub watchman_query { |
267 | + my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty') |
268 | + or die "open2() failed: $!\n" . |
269 | + "Falling back to scanning...\n"; |
270 | + |
271 | + # In the query expression below we're asking for names of files that |
272 | + # changed since $last_update_token but not from the .git folder. |
273 | + # |
274 | + # To accomplish this, we're using the "since" generator to use the |
275 | + # recency index to select candidate nodes and "fields" to limit the |
276 | + # output to file names only. Then we're using the "expression" term to |
277 | + # further constrain the results. |
278 | + my $last_update_line = ""; |
279 | + if (substr($last_update_token, 0, 1) eq "c") { |
280 | + $last_update_token = "\"$last_update_token\""; |
281 | + $last_update_line = qq[\n"since": $last_update_token,]; |
282 | + } |
283 | + my $query = <<" END"; |
284 | + ["query", "$git_work_tree", {$last_update_line |
285 | + "fields": ["name"], |
286 | + "expression": ["not", ["dirname", ".git"]] |
287 | + }] |
288 | + END |
289 | + |
290 | + # Uncomment for debugging the watchman query |
291 | + # open (my $fh, ">", ".git/watchman-query.json"); |
292 | + # print $fh $query; |
293 | + # close $fh; |
294 | + |
295 | + print CHLD_IN $query; |
296 | + close CHLD_IN; |
297 | + my $response = do {local $/; <CHLD_OUT>}; |
298 | + |
299 | + # Uncomment for debugging the watch response |
300 | + # open ($fh, ">", ".git/watchman-response.json"); |
301 | + # print $fh $response; |
302 | + # close $fh; |
303 | + |
304 | + die "Watchman: command returned no output.\n" . |
305 | + "Falling back to scanning...\n" if $response eq ""; |
306 | + die "Watchman: command returned invalid output: $response\n" . |
307 | + "Falling back to scanning...\n" unless $response =~ /^\{/; |
308 | + |
309 | + return $json_pkg->new->utf8->decode($response); |
310 | +} |
311 | + |
312 | +sub is_work_tree_watched { |
313 | + my ($output) = @_; |
314 | + my $error = $output->{error}; |
315 | + if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) { |
316 | + $retry--; |
317 | + my $response = qx/watchman watch "$git_work_tree"/; |
318 | + die "Failed to make watchman watch '$git_work_tree'.\n" . |
319 | + "Falling back to scanning...\n" if $? != 0; |
320 | + $output = $json_pkg->new->utf8->decode($response); |
321 | + $error = $output->{error}; |
322 | + die "Watchman: $error.\n" . |
323 | + "Falling back to scanning...\n" if $error; |
324 | + |
325 | + # Uncomment for debugging watchman output |
326 | + # open (my $fh, ">", ".git/watchman-output.out"); |
327 | + # close $fh; |
328 | + |
329 | + # Watchman will always return all files on the first query so |
330 | + # return the fast "everything is dirty" flag to git and do the |
331 | + # Watchman query just to get it over with now so we won't pay |
332 | + # the cost in git to look up each individual file. |
333 | + my $o = watchman_clock(); |
334 | + $error = $output->{error}; |
335 | + |
336 | + die "Watchman: $error.\n" . |
337 | + "Falling back to scanning...\n" if $error; |
338 | + |
339 | + output_result($o->{clock}, ("/")); |
340 | + $last_update_token = $o->{clock}; |
341 | + |
342 | + eval { launch_watchman() }; |
343 | + return 0; |
344 | + } |
345 | + |
346 | + die "Watchman: $error.\n" . |
347 | + "Falling back to scanning...\n" if $error; |
348 | + |
349 | + return 1; |
350 | +} |
351 | + |
352 | +sub get_working_dir { |
353 | + my $working_dir; |
354 | + if ($^O =~ 'msys' || $^O =~ 'cygwin') { |
355 | + $working_dir = Win32::GetCwd(); |
356 | + $working_dir =~ tr/\\/\//; |
357 | + } else { |
358 | + require Cwd; |
359 | + $working_dir = Cwd::cwd(); |
360 | + } |
361 | + |
362 | + return $working_dir; |
363 | +} |
364 | diff --git a/BUILD/dict/hooks/post-update.sample b/BUILD/dict/hooks/post-update.sample |
365 | new file mode 100755 |
366 | index 0000000..ec17ec1 |
367 | --- /dev/null |
368 | +++ b/BUILD/dict/hooks/post-update.sample |
369 | @@ -0,0 +1,8 @@ |
370 | +#!/bin/sh |
371 | +# |
372 | +# An example hook script to prepare a packed repository for use over |
373 | +# dumb transports. |
374 | +# |
375 | +# To enable this hook, rename this file to "post-update". |
376 | + |
377 | +exec git update-server-info |
378 | diff --git a/BUILD/dict/hooks/pre-applypatch.sample b/BUILD/dict/hooks/pre-applypatch.sample |
379 | new file mode 100755 |
380 | index 0000000..4142082 |
381 | --- /dev/null |
382 | +++ b/BUILD/dict/hooks/pre-applypatch.sample |
383 | @@ -0,0 +1,14 @@ |
384 | +#!/bin/sh |
385 | +# |
386 | +# An example hook script to verify what is about to be committed |
387 | +# by applypatch from an e-mail message. |
388 | +# |
389 | +# The hook should exit with non-zero status after issuing an |
390 | +# appropriate message if it wants to stop the commit. |
391 | +# |
392 | +# To enable this hook, rename this file to "pre-applypatch". |
393 | + |
394 | +. git-sh-setup |
395 | +precommit="$(git rev-parse --git-path hooks/pre-commit)" |
396 | +test -x "$precommit" && exec "$precommit" ${1+"$@"} |
397 | +: |
398 | diff --git a/BUILD/dict/hooks/pre-commit.sample b/BUILD/dict/hooks/pre-commit.sample |
399 | new file mode 100755 |
400 | index 0000000..e144712 |
401 | --- /dev/null |
402 | +++ b/BUILD/dict/hooks/pre-commit.sample |
403 | @@ -0,0 +1,49 @@ |
404 | +#!/bin/sh |
405 | +# |
406 | +# An example hook script to verify what is about to be committed. |
407 | +# Called by "git commit" with no arguments. The hook should |
408 | +# exit with non-zero status after issuing an appropriate message if |
409 | +# it wants to stop the commit. |
410 | +# |
411 | +# To enable this hook, rename this file to "pre-commit". |
412 | + |
413 | +if git rev-parse --verify HEAD >/dev/null 2>&1 |
414 | +then |
415 | + against=HEAD |
416 | +else |
417 | + # Initial commit: diff against an empty tree object |
418 | + against=$(git hash-object -t tree /dev/null) |
419 | +fi |
420 | + |
421 | +# If you want to allow non-ASCII filenames set this variable to true. |
422 | +allownonascii=$(git config --type=bool hooks.allownonascii) |
423 | + |
424 | +# Redirect output to stderr. |
425 | +exec 1>&2 |
426 | + |
427 | +# Cross platform projects tend to avoid non-ASCII filenames; prevent |
428 | +# them from being added to the repository. We exploit the fact that the |
429 | +# printable range starts at the space character and ends with tilde. |
430 | +if [ "$allownonascii" != "true" ] && |
431 | + # Note that the use of brackets around a tr range is ok here, (it's |
432 | + # even required, for portability to Solaris 10's /usr/bin/tr), since |
433 | + # the square bracket bytes happen to fall in the designated range. |
434 | + test $(git diff --cached --name-only --diff-filter=A -z $against | |
435 | + LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 |
436 | +then |
437 | + cat <<\EOF |
438 | +Error: Attempt to add a non-ASCII file name. |
439 | + |
440 | +This can cause problems if you want to work with people on other platforms. |
441 | + |
442 | +To be portable it is advisable to rename the file. |
443 | + |
444 | +If you know what you are doing you can disable this check using: |
445 | + |
446 | + git config hooks.allownonascii true |
447 | +EOF |
448 | + exit 1 |
449 | +fi |
450 | + |
451 | +# If there are whitespace errors, print the offending file names and fail. |
452 | +exec git diff-index --check --cached $against -- |
453 | diff --git a/BUILD/dict/hooks/pre-merge-commit.sample b/BUILD/dict/hooks/pre-merge-commit.sample |
454 | new file mode 100755 |
455 | index 0000000..399eab1 |
456 | --- /dev/null |
457 | +++ b/BUILD/dict/hooks/pre-merge-commit.sample |
458 | @@ -0,0 +1,13 @@ |
459 | +#!/bin/sh |
460 | +# |
461 | +# An example hook script to verify what is about to be committed. |
462 | +# Called by "git merge" with no arguments. The hook should |
463 | +# exit with non-zero status after issuing an appropriate message to |
464 | +# stderr if it wants to stop the merge commit. |
465 | +# |
466 | +# To enable this hook, rename this file to "pre-merge-commit". |
467 | + |
468 | +. git-sh-setup |
469 | +test -x "$GIT_DIR/hooks/pre-commit" && |
470 | + exec "$GIT_DIR/hooks/pre-commit" |
471 | +: |
472 | diff --git a/BUILD/dict/hooks/pre-push.sample b/BUILD/dict/hooks/pre-push.sample |
473 | new file mode 100755 |
474 | index 0000000..4ce688d |
475 | --- /dev/null |
476 | +++ b/BUILD/dict/hooks/pre-push.sample |
477 | @@ -0,0 +1,53 @@ |
478 | +#!/bin/sh |
479 | + |
480 | +# An example hook script to verify what is about to be pushed. Called by "git |
481 | +# push" after it has checked the remote status, but before anything has been |
482 | +# pushed. If this script exits with a non-zero status nothing will be pushed. |
483 | +# |
484 | +# This hook is called with the following parameters: |
485 | +# |
486 | +# $1 -- Name of the remote to which the push is being done |
487 | +# $2 -- URL to which the push is being done |
488 | +# |
489 | +# If pushing without using a named remote those arguments will be equal. |
490 | +# |
491 | +# Information about the commits which are being pushed is supplied as lines to |
492 | +# the standard input in the form: |
493 | +# |
494 | +# <local ref> <local oid> <remote ref> <remote oid> |
495 | +# |
496 | +# This sample shows how to prevent push of commits where the log message starts |
497 | +# with "WIP" (work in progress). |
498 | + |
499 | +remote="$1" |
500 | +url="$2" |
501 | + |
502 | +zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0') |
503 | + |
504 | +while read local_ref local_oid remote_ref remote_oid |
505 | +do |
506 | + if test "$local_oid" = "$zero" |
507 | + then |
508 | + # Handle delete |
509 | + : |
510 | + else |
511 | + if test "$remote_oid" = "$zero" |
512 | + then |
513 | + # New branch, examine all commits |
514 | + range="$local_oid" |
515 | + else |
516 | + # Update to existing branch, examine new commits |
517 | + range="$remote_oid..$local_oid" |
518 | + fi |
519 | + |
520 | + # Check for WIP commit |
521 | + commit=$(git rev-list -n 1 --grep '^WIP' "$range") |
522 | + if test -n "$commit" |
523 | + then |
524 | + echo >&2 "Found WIP commit in $local_ref, not pushing" |
525 | + exit 1 |
526 | + fi |
527 | + fi |
528 | +done |
529 | + |
530 | +exit 0 |
531 | diff --git a/BUILD/dict/hooks/pre-rebase.sample b/BUILD/dict/hooks/pre-rebase.sample |
532 | new file mode 100755 |
533 | index 0000000..6cbef5c |
534 | --- /dev/null |
535 | +++ b/BUILD/dict/hooks/pre-rebase.sample |
536 | @@ -0,0 +1,169 @@ |
537 | +#!/bin/sh |
538 | +# |
539 | +# Copyright (c) 2006, 2008 Junio C Hamano |
540 | +# |
541 | +# The "pre-rebase" hook is run just before "git rebase" starts doing |
542 | +# its job, and can prevent the command from running by exiting with |
543 | +# non-zero status. |
544 | +# |
545 | +# The hook is called with the following parameters: |
546 | +# |
547 | +# $1 -- the upstream the series was forked from. |
548 | +# $2 -- the branch being rebased (or empty when rebasing the current branch). |
549 | +# |
550 | +# This sample shows how to prevent topic branches that are already |
551 | +# merged to 'next' branch from getting rebased, because allowing it |
552 | +# would result in rebasing already published history. |
553 | + |
554 | +publish=next |
555 | +basebranch="$1" |
556 | +if test "$#" = 2 |
557 | +then |
558 | + topic="refs/heads/$2" |
559 | +else |
560 | + topic=`git symbolic-ref HEAD` || |
561 | + exit 0 ;# we do not interrupt rebasing detached HEAD |
562 | +fi |
563 | + |
564 | +case "$topic" in |
565 | +refs/heads/??/*) |
566 | + ;; |
567 | +*) |
568 | + exit 0 ;# we do not interrupt others. |
569 | + ;; |
570 | +esac |
571 | + |
572 | +# Now we are dealing with a topic branch being rebased |
573 | +# on top of master. Is it OK to rebase it? |
574 | + |
575 | +# Does the topic really exist? |
576 | +git show-ref -q "$topic" || { |
577 | + echo >&2 "No such branch $topic" |
578 | + exit 1 |
579 | +} |
580 | + |
581 | +# Is topic fully merged to master? |
582 | +not_in_master=`git rev-list --pretty=oneline ^master "$topic"` |
583 | +if test -z "$not_in_master" |
584 | +then |
585 | + echo >&2 "$topic is fully merged to master; better remove it." |
586 | + exit 1 ;# we could allow it, but there is no point. |
587 | +fi |
588 | + |
589 | +# Is topic ever merged to next? If so you should not be rebasing it. |
590 | +only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` |
591 | +only_next_2=`git rev-list ^master ${publish} | sort` |
592 | +if test "$only_next_1" = "$only_next_2" |
593 | +then |
594 | + not_in_topic=`git rev-list "^$topic" master` |
595 | + if test -z "$not_in_topic" |
596 | + then |
597 | + echo >&2 "$topic is already up to date with master" |
598 | + exit 1 ;# we could allow it, but there is no point. |
599 | + else |
600 | + exit 0 |
601 | + fi |
602 | +else |
603 | + not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` |
604 | + /usr/bin/perl -e ' |
605 | + my $topic = $ARGV[0]; |
606 | + my $msg = "* $topic has commits already merged to public branch:\n"; |
607 | + my (%not_in_next) = map { |
608 | + /^([0-9a-f]+) /; |
609 | + ($1 => 1); |
610 | + } split(/\n/, $ARGV[1]); |
611 | + for my $elem (map { |
612 | + /^([0-9a-f]+) (.*)$/; |
613 | + [$1 => $2]; |
614 | + } split(/\n/, $ARGV[2])) { |
615 | + if (!exists $not_in_next{$elem->[0]}) { |
616 | + if ($msg) { |
617 | + print STDERR $msg; |
618 | + undef $msg; |
619 | + } |
620 | + print STDERR " $elem->[1]\n"; |
621 | + } |
622 | + } |
623 | + ' "$topic" "$not_in_next" "$not_in_master" |
624 | + exit 1 |
625 | +fi |
626 | + |
627 | +<<\DOC_END |
628 | + |
629 | +This sample hook safeguards topic branches that have been |
630 | +published from being rewound. |
631 | + |
632 | +The workflow assumed here is: |
633 | + |
634 | + * Once a topic branch forks from "master", "master" is never |
635 | + merged into it again (either directly or indirectly). |
636 | + |
637 | + * Once a topic branch is fully cooked and merged into "master", |
638 | + it is deleted. If you need to build on top of it to correct |
639 | + earlier mistakes, a new topic branch is created by forking at |
640 | + the tip of the "master". This is not strictly necessary, but |
641 | + it makes it easier to keep your history simple. |
642 | + |
643 | + * Whenever you need to test or publish your changes to topic |
644 | + branches, merge them into "next" branch. |
645 | + |
646 | +The script, being an example, hardcodes the publish branch name |
647 | +to be "next", but it is trivial to make it configurable via |
648 | +$GIT_DIR/config mechanism. |
649 | + |
650 | +With this workflow, you would want to know: |
651 | + |
652 | +(1) ... if a topic branch has ever been merged to "next". Young |
653 | + topic branches can have stupid mistakes you would rather |
654 | + clean up before publishing, and things that have not been |
655 | + merged into other branches can be easily rebased without |
656 | + affecting other people. But once it is published, you would |
657 | + not want to rewind it. |
658 | + |
659 | +(2) ... if a topic branch has been fully merged to "master". |
660 | + Then you can delete it. More importantly, you should not |
661 | + build on top of it -- other people may already want to |
662 | + change things related to the topic as patches against your |
663 | + "master", so if you need further changes, it is better to |
664 | + fork the topic (perhaps with the same name) afresh from the |
665 | + tip of "master". |
666 | + |
667 | +Let's look at this example: |
668 | + |
669 | + o---o---o---o---o---o---o---o---o---o "next" |
670 | + / / / / |
671 | + / a---a---b A / / |
672 | + / / / / |
673 | + / / c---c---c---c B / |
674 | + / / / \ / |
675 | + / / / b---b C \ / |
676 | + / / / / \ / |
677 | + ---o---o---o---o---o---o---o---o---o---o---o "master" |
678 | + |
679 | + |
680 | +A, B and C are topic branches. |
681 | + |
682 | + * A has one fix since it was merged up to "next". |
683 | + |
684 | + * B has finished. It has been fully merged up to "master" and "next", |
685 | + and is ready to be deleted. |
686 | + |
687 | + * C has not merged to "next" at all. |
688 | + |
689 | +We would want to allow C to be rebased, refuse A, and encourage |
690 | +B to be deleted. |
691 | + |
692 | +To compute (1): |
693 | + |
694 | + git rev-list ^master ^topic next |
695 | + git rev-list ^master next |
696 | + |
697 | + if these match, topic has not merged in next at all. |
698 | + |
699 | +To compute (2): |
700 | + |
701 | + git rev-list master..topic |
702 | + |
703 | + if this is empty, it is fully merged to "master". |
704 | + |
705 | +DOC_END |
706 | diff --git a/BUILD/dict/hooks/pre-receive.sample b/BUILD/dict/hooks/pre-receive.sample |
707 | new file mode 100755 |
708 | index 0000000..a1fd29e |
709 | --- /dev/null |
710 | +++ b/BUILD/dict/hooks/pre-receive.sample |
711 | @@ -0,0 +1,24 @@ |
712 | +#!/bin/sh |
713 | +# |
714 | +# An example hook script to make use of push options. |
715 | +# The example simply echoes all push options that start with 'echoback=' |
716 | +# and rejects all pushes when the "reject" push option is used. |
717 | +# |
718 | +# To enable this hook, rename this file to "pre-receive". |
719 | + |
720 | +if test -n "$GIT_PUSH_OPTION_COUNT" |
721 | +then |
722 | + i=0 |
723 | + while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" |
724 | + do |
725 | + eval "value=\$GIT_PUSH_OPTION_$i" |
726 | + case "$value" in |
727 | + echoback=*) |
728 | + echo "echo from the pre-receive-hook: ${value#*=}" >&2 |
729 | + ;; |
730 | + reject) |
731 | + exit 1 |
732 | + esac |
733 | + i=$((i + 1)) |
734 | + done |
735 | +fi |
736 | diff --git a/BUILD/dict/hooks/prepare-commit-msg.sample b/BUILD/dict/hooks/prepare-commit-msg.sample |
737 | new file mode 100755 |
738 | index 0000000..10fa14c |
739 | --- /dev/null |
740 | +++ b/BUILD/dict/hooks/prepare-commit-msg.sample |
741 | @@ -0,0 +1,42 @@ |
742 | +#!/bin/sh |
743 | +# |
744 | +# An example hook script to prepare the commit log message. |
745 | +# Called by "git commit" with the name of the file that has the |
746 | +# commit message, followed by the description of the commit |
747 | +# message's source. The hook's purpose is to edit the commit |
748 | +# message file. If the hook fails with a non-zero status, |
749 | +# the commit is aborted. |
750 | +# |
751 | +# To enable this hook, rename this file to "prepare-commit-msg". |
752 | + |
753 | +# This hook includes three examples. The first one removes the |
754 | +# "# Please enter the commit message..." help message. |
755 | +# |
756 | +# The second includes the output of "git diff --name-status -r" |
757 | +# into the message, just before the "git status" output. It is |
758 | +# commented because it doesn't cope with --amend or with squashed |
759 | +# commits. |
760 | +# |
761 | +# The third example adds a Signed-off-by line to the message, that can |
762 | +# still be edited. This is rarely a good idea. |
763 | + |
764 | +COMMIT_MSG_FILE=$1 |
765 | +COMMIT_SOURCE=$2 |
766 | +SHA1=$3 |
767 | + |
768 | +/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE" |
769 | + |
770 | +# case "$COMMIT_SOURCE,$SHA1" in |
771 | +# ,|template,) |
772 | +# /usr/bin/perl -i.bak -pe ' |
773 | +# print "\n" . `git diff --cached --name-status -r` |
774 | +# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;; |
775 | +# *) ;; |
776 | +# esac |
777 | + |
778 | +# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') |
779 | +# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" |
780 | +# if test -z "$COMMIT_SOURCE" |
781 | +# then |
782 | +# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" |
783 | +# fi |
784 | diff --git a/BUILD/dict/hooks/push-to-checkout.sample b/BUILD/dict/hooks/push-to-checkout.sample |
785 | new file mode 100755 |
786 | index 0000000..af5a0c0 |
787 | --- /dev/null |
788 | +++ b/BUILD/dict/hooks/push-to-checkout.sample |
789 | @@ -0,0 +1,78 @@ |
790 | +#!/bin/sh |
791 | + |
792 | +# An example hook script to update a checked-out tree on a git push. |
793 | +# |
794 | +# This hook is invoked by git-receive-pack(1) when it reacts to git |
795 | +# push and updates reference(s) in its repository, and when the push |
796 | +# tries to update the branch that is currently checked out and the |
797 | +# receive.denyCurrentBranch configuration variable is set to |
798 | +# updateInstead. |
799 | +# |
800 | +# By default, such a push is refused if the working tree and the index |
801 | +# of the remote repository has any difference from the currently |
802 | +# checked out commit; when both the working tree and the index match |
803 | +# the current commit, they are updated to match the newly pushed tip |
804 | +# of the branch. This hook is to be used to override the default |
805 | +# behaviour; however the code below reimplements the default behaviour |
806 | +# as a starting point for convenient modification. |
807 | +# |
808 | +# The hook receives the commit with which the tip of the current |
809 | +# branch is going to be updated: |
810 | +commit=$1 |
811 | + |
812 | +# It can exit with a non-zero status to refuse the push (when it does |
813 | +# so, it must not modify the index or the working tree). |
814 | +die () { |
815 | + echo >&2 "$*" |
816 | + exit 1 |
817 | +} |
818 | + |
819 | +# Or it can make any necessary changes to the working tree and to the |
820 | +# index to bring them to the desired state when the tip of the current |
821 | +# branch is updated to the new commit, and exit with a zero status. |
822 | +# |
823 | +# For example, the hook can simply run git read-tree -u -m HEAD "$1" |
824 | +# in order to emulate git fetch that is run in the reverse direction |
825 | +# with git push, as the two-tree form of git read-tree -u -m is |
826 | +# essentially the same as git switch or git checkout that switches |
827 | +# branches while keeping the local changes in the working tree that do |
828 | +# not interfere with the difference between the branches. |
829 | + |
830 | +# The below is a more-or-less exact translation to shell of the C code |
831 | +# for the default behaviour for git's push-to-checkout hook defined in |
832 | +# the push_to_deploy() function in builtin/receive-pack.c. |
833 | +# |
834 | +# Note that the hook will be executed from the repository directory, |
835 | +# not from the working tree, so if you want to perform operations on |
836 | +# the working tree, you will have to adapt your code accordingly, e.g. |
837 | +# by adding "cd .." or using relative paths. |
838 | + |
839 | +if ! git update-index -q --ignore-submodules --refresh |
840 | +then |
841 | + die "Up-to-date check failed" |
842 | +fi |
843 | + |
844 | +if ! git diff-files --quiet --ignore-submodules -- |
845 | +then |
846 | + die "Working directory has unstaged changes" |
847 | +fi |
848 | + |
849 | +# This is a rough translation of: |
850 | +# |
851 | +# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX |
852 | +if git cat-file -e HEAD 2>/dev/null |
853 | +then |
854 | + head=HEAD |
855 | +else |
856 | + head=$(git hash-object -t tree --stdin </dev/null) |
857 | +fi |
858 | + |
859 | +if ! git diff-index --quiet --cached --ignore-submodules $head -- |
860 | +then |
861 | + die "Working directory has staged changes" |
862 | +fi |
863 | + |
864 | +if ! git read-tree -u -m "$commit" |
865 | +then |
866 | + die "Could not update working tree to new HEAD" |
867 | +fi |
868 | diff --git a/BUILD/dict/hooks/sendemail-validate.sample b/BUILD/dict/hooks/sendemail-validate.sample |
869 | new file mode 100755 |
870 | index 0000000..640bcf8 |
871 | --- /dev/null |
872 | +++ b/BUILD/dict/hooks/sendemail-validate.sample |
873 | @@ -0,0 +1,77 @@ |
874 | +#!/bin/sh |
875 | + |
876 | +# An example hook script to validate a patch (and/or patch series) before |
877 | +# sending it via email. |
878 | +# |
879 | +# The hook should exit with non-zero status after issuing an appropriate |
880 | +# message if it wants to prevent the email(s) from being sent. |
881 | +# |
882 | +# To enable this hook, rename this file to "sendemail-validate". |
883 | +# |
884 | +# By default, it will only check that the patch(es) can be applied on top of |
885 | +# the default upstream branch without conflicts in a secondary worktree. After |
886 | +# validation (successful or not) of the last patch of a series, the worktree |
887 | +# will be deleted. |
888 | +# |
889 | +# The following config variables can be set to change the default remote and |
890 | +# remote ref that are used to apply the patches against: |
891 | +# |
892 | +# sendemail.validateRemote (default: origin) |
893 | +# sendemail.validateRemoteRef (default: HEAD) |
894 | +# |
895 | +# Replace the TODO placeholders with appropriate checks according to your |
896 | +# needs. |
897 | + |
898 | +validate_cover_letter () { |
899 | + file="$1" |
900 | + # TODO: Replace with appropriate checks (e.g. spell checking). |
901 | + true |
902 | +} |
903 | + |
904 | +validate_patch () { |
905 | + file="$1" |
906 | + # Ensure that the patch applies without conflicts. |
907 | + git am -3 "$file" || return |
908 | + # TODO: Replace with appropriate checks for this patch |
909 | + # (e.g. checkpatch.pl). |
910 | + true |
911 | +} |
912 | + |
913 | +validate_series () { |
914 | + # TODO: Replace with appropriate checks for the whole series |
915 | + # (e.g. quick build, coding style checks, etc.). |
916 | + true |
917 | +} |
918 | + |
919 | +# main ------------------------------------------------------------------------- |
920 | + |
921 | +if test "$GIT_SENDEMAIL_FILE_COUNTER" = 1 |
922 | +then |
923 | + remote=$(git config --default origin --get sendemail.validateRemote) && |
924 | + ref=$(git config --default HEAD --get sendemail.validateRemoteRef) && |
925 | + worktree=$(mktemp --tmpdir -d sendemail-validate.XXXXXXX) && |
926 | + git worktree add -fd --checkout "$worktree" "refs/remotes/$remote/$ref" && |
927 | + git config --replace-all sendemail.validateWorktree "$worktree" |
928 | +else |
929 | + worktree=$(git config --get sendemail.validateWorktree) |
930 | +fi || { |
931 | + echo "sendemail-validate: error: failed to prepare worktree" >&2 |
932 | + exit 1 |
933 | +} |
934 | + |
935 | +unset GIT_DIR GIT_WORK_TREE |
936 | +cd "$worktree" && |
937 | + |
938 | +if grep -q "^diff --git " "$1" |
939 | +then |
940 | + validate_patch "$1" |
941 | +else |
942 | + validate_cover_letter "$1" |
943 | +fi && |
944 | + |
945 | +if test "$GIT_SENDEMAIL_FILE_COUNTER" = "$GIT_SENDEMAIL_FILE_TOTAL" |
946 | +then |
947 | + git config --unset-all sendemail.validateWorktree && |
948 | + trap 'git worktree remove -ff "$worktree"' EXIT && |
949 | + validate_series |
950 | +fi |
951 | diff --git a/BUILD/dict/hooks/update.sample b/BUILD/dict/hooks/update.sample |
952 | new file mode 100755 |
953 | index 0000000..c4d426b |
954 | --- /dev/null |
955 | +++ b/BUILD/dict/hooks/update.sample |
956 | @@ -0,0 +1,128 @@ |
957 | +#!/bin/sh |
958 | +# |
959 | +# An example hook script to block unannotated tags from entering. |
960 | +# Called by "git receive-pack" with arguments: refname sha1-old sha1-new |
961 | +# |
962 | +# To enable this hook, rename this file to "update". |
963 | +# |
964 | +# Config |
965 | +# ------ |
966 | +# hooks.allowunannotated |
967 | +# This boolean sets whether unannotated tags will be allowed into the |
968 | +# repository. By default they won't be. |
969 | +# hooks.allowdeletetag |
970 | +# This boolean sets whether deleting tags will be allowed in the |
971 | +# repository. By default they won't be. |
972 | +# hooks.allowmodifytag |
973 | +# This boolean sets whether a tag may be modified after creation. By default |
974 | +# it won't be. |
975 | +# hooks.allowdeletebranch |
976 | +# This boolean sets whether deleting branches will be allowed in the |
977 | +# repository. By default they won't be. |
978 | +# hooks.denycreatebranch |
979 | +# This boolean sets whether remotely creating branches will be denied |
980 | +# in the repository. By default this is allowed. |
981 | +# |
982 | + |
983 | +# --- Command line |
984 | +refname="$1" |
985 | +oldrev="$2" |
986 | +newrev="$3" |
987 | + |
988 | +# --- Safety check |
989 | +if [ -z "$GIT_DIR" ]; then |
990 | + echo "Don't run this script from the command line." >&2 |
991 | + echo " (if you want, you could supply GIT_DIR then run" >&2 |
992 | + echo " $0 <ref> <oldrev> <newrev>)" >&2 |
993 | + exit 1 |
994 | +fi |
995 | + |
996 | +if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then |
997 | + echo "usage: $0 <ref> <oldrev> <newrev>" >&2 |
998 | + exit 1 |
999 | +fi |