-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add check integrity script #557
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env bash | ||
|
||
err() { | ||
echo "$1" | ||
exit 1 | ||
} | ||
|
||
check_bash_script() { | ||
local cmd="git-$1" | ||
test -x "bin/$cmd" || err "bin/$cmd is either non-existent or unexecutable" | ||
shebang=$(head -n 1 "bin/$cmd") | ||
test "$shebang" == "#!/usr/bin/env bash" || \ | ||
err "start git-$1 with '#!/usr/bin/env bash'" | ||
} | ||
|
||
check_documentation() { | ||
local cmd="git-$1" | ||
test -f "man/$cmd.md" || err "man/$cmd.md required" | ||
test -f "man/$cmd.1" || err "man/$cmd.1 required" | ||
test -f "man/$cmd.html" || err "man/$cmd.html required" | ||
} | ||
|
||
check_Commands_page() { | ||
local whitelist=('bug' 'chore' 'feature' 'refactor') | ||
for cmd in ${whitelist[*]}; do | ||
test "$1" == "$cmd" && return | ||
done | ||
grep "\- \[\`git $1\`\](#git-$1)" Commands.md > /dev/null && \ | ||
grep "^## git $1" Commands.md > /dev/null || \ | ||
err "Update Commands.md with git-$1 is required" | ||
} | ||
|
||
check_completion() { | ||
grep "$1:" etc/git-extras-completion.zsh > /dev/null || \ | ||
err "Update git-extras-completion.zsh with git-$1 is required" | ||
} | ||
|
||
check() { | ||
check_bash_script "$1" | ||
check_documentation "$1" | ||
check_Commands_page "$1" | ||
check_completion "$1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I imagine it will take two days before someone posts an issue about |
||
} | ||
|
||
test $# == 0 && err "Please give your command name" | ||
for name in "$@"; do | ||
[[ "$name" == "rscp" || "$name" == "line-summary" ]] && continue | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we |
||
check "$name" | ||
done | ||
echo 'All is done' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps change this to "either doesn't exist or is not executable".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm reviewing the file now. I'll be posting a patch in a few minutes, and I'll address that.