improve the quality of the integrity check.

This commit is contained in:
spacewander 2019-08-18 11:35:57 +08:00
parent 4867571df0
commit 5bffcb4c89
3 changed files with 10 additions and 7 deletions

View file

@ -4,14 +4,14 @@
* Bash 3.2+ (If you aren't sure, see [the Bash changelog](http://tldp.org/LDP/abs/html/bash2.html))
* Git 2.1+
<sup>*</sup>If you aren't able to test your new command on a platform,
<sup>*</sup>If you aren't able to test your new command on a platform,
make that clear in your PR and someone else may be able to test it on their system.
## To submit a new command, you should
Let's assume your new command is named `foo`.
1. Write a bash script under `./bin` called `git-foo`.
1. Write a bash script under `./bin` called `git-foo`. The script should be started with `#!/usr/bin/env bash`.
2. Read `./man/Readme.md` and write documentation for `git-foo`.
3. Don't forget to introduce it in `Commands.md`.
4. Update `./etc/git-extras-completion.zsh`. Just follow existing code.

View file

@ -5,6 +5,10 @@ err() {
exit 1
}
make_doc() {
echo "'touch man/git-$1.md && make man/git-$1.{1,html}'"
}
check_bash_script() {
local cmd="git-$1"
@ -26,12 +30,12 @@ check_git_extras_cmd_list() {
done
grep "\- \*\*git\-$1(1)\*\*" man/git-extras.md >/dev/null \
|| err "Add git-$1 in the list of commands in man/git-extras.md"
|| err "Add git-$1 in the list of commands in man/git-extras.md via $(make_doc "$1")"
}
check_man_page_index() {
grep "git\-$1(1) git\-$1" man/index.txt >/dev/null \
|| err "Add git-$1 to index.txt"
|| err "Add git-$1 to index.txt via $(make_doc "$1")"
}
check_documentation() {
@ -40,7 +44,7 @@ check_documentation() {
if [ ! -f "man/$cmd.1" ] || [ ! -f "man/$cmd.html" ]
then
err "Run 'make docs' to create man/$cmd.1 and man/$cmd.html"
err "Create man/$cmd.1 and man/$cmd.html via $(make_doc "$1")"
fi
check_git_extras_cmd_list "$@"
@ -87,4 +91,3 @@ for name in "$@"; do
done
echo 'All done'
exit 0

View file

@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
make_install() {
if [ -n "$PREFIX" ]