Browse code

move the contributing hook into hack, and use curl in the same way as the gofmt above

and remove the fmt-check one we don't document

tianon tells me they're called GitHub, not Github :)

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@fosiki.com> (github: SvenDowideit)

Docker-DCO-1.1-Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au> (github: SvenDowideit)

Sven Dowideit authored on 2014/01/10 11:56:05
Showing 5 changed files
... ...
@@ -7,7 +7,7 @@ feels wrong or incomplete.
7 7
 ## Reporting Issues
8 8
 
9 9
 When reporting [issues](https://github.com/dotcloud/docker/issues) 
10
-on Github please include your host OS ( Ubuntu 12.04, Fedora 19, etc... )
10
+on GitHub please include your host OS ( Ubuntu 12.04, Fedora 19, etc... )
11 11
 and the output of `docker version` along with the output of `docker info` if possible.  
12 12
 This information will help us review and fix your issue faster.
13 13
 
... ...
@@ -45,7 +45,7 @@ else is working on the same thing.
45 45
 
46 46
 ### Create issues...
47 47
 
48
-Any significant improvement should be documented as [a github
48
+Any significant improvement should be documented as [a GitHub
49 49
 issue](https://github.com/dotcloud/docker/issues) before anybody
50 50
 starts working on it.
51 51
 
... ...
@@ -146,19 +146,13 @@ then you just add a line to every git commit message:
146 146
 using your real name (sorry, no pseudonyms or anonymous contributions.)
147 147
 
148 148
 One way to automate this, is customise your get ``commit.template`` by adding
149
-the following to your ``.git/hooks/prepare-commit-msg`` script (needs 
150
-``chmod 755 .git/hooks/prepare-commit-msg`` ) in the docker checkout:
149
+a ``prepare-commit-msg`` hook to your docker checkout:
151 150
 
152 151
 ```
153
-   #!/bin/sh
154
-   #       Auto sign all commits to allow them to be used by the Docker project.
155
-   #       see https://github.com/dotcloud/docker/blob/master/CONTRIBUTING.md#sign-your-work
156
-   #
157
-   GH_USER=$(git config --get github.user)
158
-   SOB=$(git var GIT_AUTHOR_IDENT | sed -n "s/^\(.*>\).*$/Docker-DCO-1.1-Signed-off-by: \1 \(github: $GH_USER\)/p")
159
-   grep -qs "^$SOB" "$1" || echo "\n$SOB" >> "$1"
152
+curl -o .git/hooks/prepare-commit-msg https://raw.github.com/dotcloud/docker/master/contrib/prepare-commit-msg.hook && chmod +x .git/hooks/prepare-commit-msg
153
+``
160 154
 
161
-```
155
+* Note: the above script expects to find your GitHub user name in ``git config --get github.user``
162 156
 
163 157
 If you have any questions, please refer to the FAQ in the [docs](http://docs.docker.io)
164 158
 
165 159
new file mode 100644
... ...
@@ -0,0 +1,7 @@
0
+#!/bin/sh
1
+#       Auto sign all commits to allow them to be used by the Docker project.
2
+#       see https://github.com/dotcloud/docker/blob/master/CONTRIBUTING.md#sign-your-work
3
+#
4
+GH_USER=$(git config --get github.user)
5
+SOB=$(git var GIT_AUTHOR_IDENT | sed -n "s/^\(.*>\).*$/Docker-DCO-1.1-Signed-off-by: \1 \(github: $GH_USER\)/p")
6
+grep -qs "^$SOB" "$1" || echo "\n$SOB" >> "$1"
... ...
@@ -34,7 +34,7 @@ It can be as simple as this to create an Ubuntu base image::
34 34
   DISTRIB_DESCRIPTION="Ubuntu 13.04"
35 35
 
36 36
 There are more example scripts for creating base images in the
37
-Docker Github Repo:
37
+Docker GitHub Repo:
38 38
 
39 39
 * `BusyBox <https://github.com/dotcloud/docker/blob/master/contrib/mkimage-busybox.sh>`_
40 40
 * `CentOS / Scientific Linux CERN (SLC)
... ...
@@ -196,7 +196,7 @@ Where can I find more answers?
196 196
     * `Docker user mailinglist`_
197 197
     * `Docker developer mailinglist`_
198 198
     * `IRC, docker on freenode`_
199
-    * `Github`_
199
+    * `GitHub`_
200 200
     * `Ask questions on Stackoverflow`_
201 201
     * `Join the conversation on Twitter`_
202 202
 
203 203
deleted file mode 100644
... ...
@@ -1,46 +0,0 @@
1
-#!/bin/sh
2
-
3
-# This pre-commit hook will abort if a committed file doesn't pass gofmt.
4
-# By Even Shaw <edsrzf@gmail.com>
5
-# http://github.com/edsrzf/gofmt-git-hook
6
-
7
-test_fmt() {
8
-    hash gofmt 2>&- || { echo >&2 "gofmt not in PATH."; exit 1; }
9
-    IFS='
10
-'
11
-    for file in `git diff --cached --name-only --diff-filter=ACM | grep '\.go$'`
12
-    do
13
-        output=`git cat-file -p :$file | gofmt -l 2>&1`
14
-        if test $? -ne 0
15
-        then
16
-            output=`echo "$output" | sed "s,<standard input>,$file,"`
17
-            syntaxerrors="${list}${output}\n"
18
-        elif test -n "$output"
19
-        then
20
-            list="${list}${file}\n"
21
-        fi
22
-    done
23
-    exitcode=0
24
-    if test -n "$syntaxerrors"
25
-    then
26
-        echo >&2 "gofmt found syntax errors:"
27
-        printf "$syntaxerrors"
28
-        exitcode=1
29
-    fi
30
-    if test -n "$list"
31
-    then
32
-        echo >&2 "gofmt needs to format these files (run gofmt -w and git add):"
33
-        printf "$list"
34
-        exitcode=1
35
-    fi
36
-    exit $exitcode
37
-}
38
-
39
-case "$1" in
40
-    --about )
41
-        echo "Check Go code formatting"
42
-        ;;
43
-    * )
44
-        test_fmt
45
-        ;;
46
-esac