Add reviews
We can now add very simple reviews as git notes! (and watch them float off into the void where noone will ever read them).
This commit is contained in:
commit
5307736cc9
|
@ -0,0 +1,32 @@
|
||||||
|
# git-cr
|
||||||
|
|
||||||
|
git-cr is a code review system which works at the commit, rather than PR, level.
|
||||||
|
It is designed for use by teams practising trunk-based development, where
|
||||||
|
reviews take place _after_ code is merged. If this sounds crazy, see
|
||||||
|
[my blog post on the topic](https://tsvallender.co.uk/blog_posts/a-vision-of-continuous-integration).
|
||||||
|
|
||||||
|
git-cr stores code reviews in the same repository as your code, using
|
||||||
|
[git notes](https://git-scm.com/docs/git-notes). It allows you to review commits in
|
||||||
|
your own editor, with no other special tooling. It’s designed to be incredibly minimal
|
||||||
|
and meet you where you are.
|
||||||
|
|
||||||
|
git-cr is a collection of BASH scripts, and should run on any UNIX-like system.
|
||||||
|
|
||||||
|
git-cr is _very_ new and not ready for any kind of use!
|
||||||
|
|
||||||
|
## Workflow
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git cr n # Review the currently checked out commit
|
||||||
|
```
|
||||||
|
|
||||||
|
## Features coming soon
|
||||||
|
|
||||||
|
- List reviews on your commits only
|
||||||
|
- Tag necessary actions in reviews
|
||||||
|
- List actions needed
|
||||||
|
- Hook in your ticketing system to automatically make tickets from requested actions
|
||||||
|
|
||||||
|
## Features coming maybe
|
||||||
|
|
||||||
|
- Improved editor support for working with review files
|
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# git-cr-new
|
||||||
|
# Adds a review at HEAD
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
|
||||||
|
|
||||||
|
USERNAME=$(git config user.name)
|
||||||
|
TMP_FILE=".git/REVIEW_EDITMSG.tmp"
|
||||||
|
MSG_FILE=".git/REVIEW_EDITMSG"
|
||||||
|
|
||||||
|
main () {
|
||||||
|
# Get a formatted patch of the current permit as a starting point for the note
|
||||||
|
git diff HEAD~1 HEAD | grep -E '^[+-]' | sed -e '/---/i\\' | sed -e 's/^/# /' > "$TMP_FILE"
|
||||||
|
|
||||||
|
vi "$TMP_FILE"
|
||||||
|
|
||||||
|
# Remove comments
|
||||||
|
grep -Ev '^#' "$TMP_FILE" > "$MSG_FILE"
|
||||||
|
# Sign off
|
||||||
|
echo -e "\n--\nReviewed by $USERNAME\n--\n" >> "$MSG_FILE"
|
||||||
|
|
||||||
|
git notes append --file="$MSG_FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
|
||||||
|
|
||||||
|
while getopts "n" flag
|
||||||
|
do
|
||||||
|
case "${flag}" in
|
||||||
|
n) git-cr-new.bash;;
|
||||||
|
*) echo "Unexpected option ${flag}"; exit 1;;
|
||||||
|
esac
|
||||||
|
done
|
Loading…
Reference in New Issue