summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/.gitignore1
-rw-r--r--templates/Makefile40
-rw-r--r--templates/branches--1
-rw-r--r--templates/hooks--applypatch-msg14
-rw-r--r--templates/hooks--commit-msg14
-rw-r--r--templates/hooks--post-commit8
-rw-r--r--templates/hooks--post-update8
-rw-r--r--templates/hooks--pre-applypatch14
-rw-r--r--templates/hooks--pre-commit61
-rw-r--r--templates/hooks--update31
-rw-r--r--templates/info--exclude6
-rw-r--r--templates/remotes--1
-rw-r--r--templates/this--description1
13 files changed, 200 insertions, 0 deletions
diff --git a/templates/.gitignore b/templates/.gitignore
new file mode 100644
index 0000000000..ca680c5b9c
--- /dev/null
+++ b/templates/.gitignore
@@ -0,0 +1 @@
+blt
diff --git a/templates/Makefile b/templates/Makefile
new file mode 100644
index 0000000000..221a086066
--- /dev/null
+++ b/templates/Makefile
@@ -0,0 +1,40 @@
+# make and install sample templates
+
+INSTALL ?= install
+TAR ?= tar
+prefix ?= $(HOME)
+template_dir ?= $(prefix)/share/git-core/templates/
+# DESTDIR=
+
+all: boilerplates custom
+ find blt
+
+# Put templates that can be copied straight from the source
+# in a file direc--tory--file in the source. They will be
+# just copied to the destination.
+boilerplates:
+ ls *--* 2>/dev/null | \
+ while read boilerplate; \
+ do \
+ case "$$boilerplate" in *~) continue ;; esac && \
+ dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \
+ dir=`expr "$$dst" : '\(.*\)/'` && \
+ mkdir -p blt/$$dir && \
+ case "$$boilerplate" in \
+ *--) ;; \
+ *) cp $$boilerplate blt/$$dst ;; \
+ esac || exit; \
+ done || exit
+
+# If you need build-tailored templates, build them into blt/
+# directory yourself here.
+custom:
+ : no custom templates yet
+
+clean:
+ rm -rf blt
+
+install: all
+ $(INSTALL) -d -m755 $(DESTDIR)$(template_dir)
+ (cd blt && $(TAR) cf - .) | \
+ (cd $(DESTDIR)$(template_dir) && $(TAR) xf -)
diff --git a/templates/branches-- b/templates/branches--
new file mode 100644
index 0000000000..fae88709a6
--- /dev/null
+++ b/templates/branches--
@@ -0,0 +1 @@
+: this is just to ensure the directory exists.
diff --git a/templates/hooks--applypatch-msg b/templates/hooks--applypatch-msg
new file mode 100644
index 0000000000..bda3c86be7
--- /dev/null
+++ b/templates/hooks--applypatch-msg
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# An example hook script to check the commit log message taken by
+# applypatch from an e-mail message.
+#
+# The hook should exit with non-zero status after issuing an
+# appropriate message if it wants to stop the commit. The hook is
+# allowed to edit the commit message file.
+#
+# To enable this hook, make this file executable.
+
+test -x "$GIT_DIR/hooks/commit-msg" &&
+ exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
+:
diff --git a/templates/hooks--commit-msg b/templates/hooks--commit-msg
new file mode 100644
index 0000000000..643822d235
--- /dev/null
+++ b/templates/hooks--commit-msg
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# An example hook script to check the commit log message.
+# Called by git-commit with one argument, the name of the file
+# that has the commit message. The hook should exit with non-zero
+# status after issuing an appropriate message if it wants to stop the
+# commit. The hook is allowed to edit the commit message file.
+#
+# To enable this hook, make this file executable.
+
+# This example catches duplicate Signed-off-by lines.
+
+test "" = "$(grep '^Signed-off-by: ' "$1" |
+ sort | uniq -c | sed -e '/^[ ]*1 /d')"
diff --git a/templates/hooks--post-commit b/templates/hooks--post-commit
new file mode 100644
index 0000000000..8be6f34ad9
--- /dev/null
+++ b/templates/hooks--post-commit
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# An example hook script that is called after a successful
+# commit is made.
+#
+# To enable this hook, make this file executable.
+
+: Nothing
diff --git a/templates/hooks--post-update b/templates/hooks--post-update
new file mode 100644
index 0000000000..bcba8937bb
--- /dev/null
+++ b/templates/hooks--post-update
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# An example hook script to prepare a packed repository for use over
+# dumb transports.
+#
+# To enable this hook, make this file executable by "chmod +x post-update".
+
+exec git-update-server-info
diff --git a/templates/hooks--pre-applypatch b/templates/hooks--pre-applypatch
new file mode 100644
index 0000000000..a54751600e
--- /dev/null
+++ b/templates/hooks--pre-applypatch
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed
+# by applypatch from an e-mail message.
+#
+# The hook should exit with non-zero status after issuing an
+# appropriate message if it wants to stop the commit.
+#
+# To enable this hook, make this file executable.
+
+test -x "$GIT_DIR/hooks/pre-commit" &&
+ exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
+:
+
diff --git a/templates/hooks--pre-commit b/templates/hooks--pre-commit
new file mode 100644
index 0000000000..4bb6803b10
--- /dev/null
+++ b/templates/hooks--pre-commit
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed.
+# Called by git-commit with no arguments. The hook should
+# exit with non-zero status after issuing an appropriate message if
+# it wants to stop the commit.
+#
+# To enable this hook, make this file executable.
+
+# This is slightly modified from Andrew Morton's Perfect Patch.
+# Lines you introduce should not have trailing whitespace.
+# Also check for an indentation that has SP before a TAB.
+perl -e '
+ my $fh;
+ my $found_bad = 0;
+ my $filename;
+ my $reported_filename = "";
+ my $lineno;
+ sub bad_line {
+ my ($why, $line) = @_;
+ if (!$found_bad) {
+ print STDERR "*\n";
+ print STDERR "* You have some suspicious patch lines:\n";
+ print STDERR "*\n";
+ $found_bad = 1;
+ }
+ if ($reported_filename ne $filename) {
+ print STDERR "* In $filename\n";
+ $reported_filename = $filename;
+ }
+ print STDERR "* $why (line $lineno)\n";
+ print STDERR "$filename:$lineno:$line\n";
+ }
+ open $fh, "-|", qw(git-diff-index -p -M --cached HEAD);
+ while (<$fh>) {
+ if (m|^diff --git a/(.*) b/\1$|) {
+ $filename = $1;
+ next;
+ }
+ if (/^@@ -\S+ \+(\d+)/) {
+ $lineno = $1 - 1;
+ next;
+ }
+ if (/^ /) {
+ $lineno++;
+ next;
+ }
+ if (s/^\+//) {
+ $lineno++;
+ chomp;
+ if (/\s$/) {
+ bad_line("trailing whitespace", $_);
+ }
+ if (/^\s* /) {
+ bad_line("indent SP followed by a TAB", $_);
+ }
+ }
+ }
+ exit($found_bad);
+'
+
diff --git a/templates/hooks--update b/templates/hooks--update
new file mode 100644
index 0000000000..3f38b82a47
--- /dev/null
+++ b/templates/hooks--update
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# An example hook script to mail out commit update information.
+# Called by git-receive-pack with arguments: refname sha1-old sha1-new
+#
+# To enable this hook:
+# (1) change the recipient e-mail address
+# (2) make this file executable by "chmod +x update".
+#
+
+recipient="commit-list@mydomain.xz"
+
+if expr "$2" : '0*$' >/dev/null
+then
+ echo "Created a new ref, with the following commits:"
+ git-rev-list --pretty "$3"
+else
+ $base=$(git-merge-base "$2" "$3")
+ case "$base" in
+ "$2")
+ echo "New commits:"
+ ;;
+ *)
+ echo "Rebased ref, commits from common ancestor:"
+ ;;
+ esac
+fi
+git-rev-list --pretty "$3" "^$base"
+fi |
+mail -s "Changes to ref $1" "$recipient"
+exit 0
diff --git a/templates/info--exclude b/templates/info--exclude
new file mode 100644
index 0000000000..2c87b72dff
--- /dev/null
+++ b/templates/info--exclude
@@ -0,0 +1,6 @@
+# git-ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~
diff --git a/templates/remotes-- b/templates/remotes--
new file mode 100644
index 0000000000..fae88709a6
--- /dev/null
+++ b/templates/remotes--
@@ -0,0 +1 @@
+: this is just to ensure the directory exists.
diff --git a/templates/this--description b/templates/this--description
new file mode 100644
index 0000000000..c6f25e80b8
--- /dev/null
+++ b/templates/this--description
@@ -0,0 +1 @@
+Unnamed repository; edit this file to name it for gitweb.