浏览代码

Merge pull request #3542 from SvenDowideit/curl-prepare-commit-msg

move the contributing hook into contrib, and use curl in the same way as the gofmt above
Andy Rothfusz 11 年之前
父节点
当前提交
bbfc531b51
共有 5 个文件被更改,包括 15 次插入60 次删除
  1. 6 12
      CONTRIBUTING.md
  2. 7 0
      contrib/prepare-commit-msg.hook
  3. 1 1
      docs/sources/articles/baseimages.rst
  4. 1 1
      docs/sources/faq.rst
  5. 0 46
      hack/fmt-check.hook

+ 6 - 12
CONTRIBUTING.md

@@ -7,7 +7,7 @@ feels wrong or incomplete.
 ## Reporting Issues
 
 When reporting [issues](https://github.com/dotcloud/docker/issues) 
-on Github please include your host OS ( Ubuntu 12.04, Fedora 19, etc... )
+on GitHub please include your host OS ( Ubuntu 12.04, Fedora 19, etc... )
 and the output of `docker version` along with the output of `docker info` if possible.  
 This information will help us review and fix your issue faster.
 
@@ -45,7 +45,7 @@ else is working on the same thing.
 
 ### Create issues...
 
-Any significant improvement should be documented as [a github
+Any significant improvement should be documented as [a GitHub
 issue](https://github.com/dotcloud/docker/issues) before anybody
 starts working on it.
 
@@ -146,19 +146,13 @@ then you just add a line to every git commit message:
 using your real name (sorry, no pseudonyms or anonymous contributions.)
 
 One way to automate this, is customise your get ``commit.template`` by adding
-the following to your ``.git/hooks/prepare-commit-msg`` script (needs 
-``chmod 755 .git/hooks/prepare-commit-msg`` ) in the docker checkout:
+a ``prepare-commit-msg`` hook to your docker checkout:
 
 ```
-   #!/bin/sh
-   #       Auto sign all commits to allow them to be used by the Docker project.
-   #       see https://github.com/dotcloud/docker/blob/master/CONTRIBUTING.md#sign-your-work
-   #
-   GH_USER=$(git config --get github.user)
-   SOB=$(git var GIT_AUTHOR_IDENT | sed -n "s/^\(.*>\).*$/Docker-DCO-1.1-Signed-off-by: \1 \(github: $GH_USER\)/p")
-   grep -qs "^$SOB" "$1" || echo "\n$SOB" >> "$1"
+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
+``
 
-```
+* Note: the above script expects to find your GitHub user name in ``git config --get github.user``
 
 If you have any questions, please refer to the FAQ in the [docs](http://docs.docker.io)
 

+ 7 - 0
contrib/prepare-commit-msg.hook

@@ -0,0 +1,7 @@
+#!/bin/sh
+#       Auto sign all commits to allow them to be used by the Docker project.
+#       see https://github.com/dotcloud/docker/blob/master/CONTRIBUTING.md#sign-your-work
+#
+GH_USER=$(git config --get github.user)
+SOB=$(git var GIT_AUTHOR_IDENT | sed -n "s/^\(.*>\).*$/Docker-DCO-1.1-Signed-off-by: \1 \(github: $GH_USER\)/p")
+grep -qs "^$SOB" "$1" || echo "\n$SOB" >> "$1"

+ 1 - 1
docs/sources/articles/baseimages.rst

@@ -34,7 +34,7 @@ It can be as simple as this to create an Ubuntu base image::
   DISTRIB_DESCRIPTION="Ubuntu 13.04"
 
 There are more example scripts for creating base images in the
-Docker Github Repo:
+Docker GitHub Repo:
 
 * `BusyBox <https://github.com/dotcloud/docker/blob/master/contrib/mkimage-busybox.sh>`_
 * `CentOS / Scientific Linux CERN (SLC)

+ 1 - 1
docs/sources/faq.rst

@@ -196,7 +196,7 @@ Where can I find more answers?
     * `Docker user mailinglist`_
     * `Docker developer mailinglist`_
     * `IRC, docker on freenode`_
-    * `Github`_
+    * `GitHub`_
     * `Ask questions on Stackoverflow`_
     * `Join the conversation on Twitter`_
 

+ 0 - 46
hack/fmt-check.hook

@@ -1,46 +0,0 @@
-#!/bin/sh
-
-# This pre-commit hook will abort if a committed file doesn't pass gofmt.
-# By Even Shaw <edsrzf@gmail.com>
-# http://github.com/edsrzf/gofmt-git-hook
-
-test_fmt() {
-    hash gofmt 2>&- || { echo >&2 "gofmt not in PATH."; exit 1; }
-    IFS='
-'
-    for file in `git diff --cached --name-only --diff-filter=ACM | grep '\.go$'`
-    do
-        output=`git cat-file -p :$file | gofmt -l 2>&1`
-        if test $? -ne 0
-        then
-            output=`echo "$output" | sed "s,<standard input>,$file,"`
-            syntaxerrors="${list}${output}\n"
-        elif test -n "$output"
-        then
-            list="${list}${file}\n"
-        fi
-    done
-    exitcode=0
-    if test -n "$syntaxerrors"
-    then
-        echo >&2 "gofmt found syntax errors:"
-        printf "$syntaxerrors"
-        exitcode=1
-    fi
-    if test -n "$list"
-    then
-        echo >&2 "gofmt needs to format these files (run gofmt -w and git add):"
-        printf "$list"
-        exitcode=1
-    fi
-    exit $exitcode
-}
-
-case "$1" in
-    --about )
-        echo "Check Go code formatting"
-        ;;
-    * )
-        test_fmt
-        ;;
-esac