aboutsummaryrefslogtreecommitdiffstats
path: root/code-review-start
AgeCommit message (Collapse)Author
2019-06-10Add license (GNU GPLv3+)Teddy Wing
2019-06-09code-review-start: Only insert merge_bases row if argument was passedTeddy Wing
Don't create a `merge_bases` entry in the database if no merge base argument was passed to the script. The `get_merge_base` function in `code-review-database` will default to `origin/master` or `master` when no row is found in the database. Rely on those defaults instead of always inserting a row.
2019-06-09Move database functions from code-review-start to code-review-databaseTeddy Wing
Put these functions in a function-only file that can be sourced by other scripts that need database access.
2019-06-09code-review-start: Add `get_merge_base` functionTeddy Wing
Function to get the merge base for the current branch. If none exists in the database, default to `origin/master` if there's an `origin` remote, or `master` if not. Thanks to Serpiton (https://codereview.stackexchange.com/users/61525/serpiton) on Stack Overflow for describing how to get a default value using the `MAX()` function: https://codereview.stackexchange.com/questions/74192/select-first-value-if-exists-otherwise-select-default-value/74252#74252 Thanks to 'tig' (https://stackoverflow.com/users/96823/tig) on Stack Overflow for the command to check if a given Git remote exists: https://stackoverflow.com/questions/12170459/check-if-git-remote-exists-before-first-push/26843249#26843249
2019-06-05code-review-start: Add TODO for upsertTeddy Wing
2019-06-05Add draft of 'code-review-start'Teddy Wing
This command will store the desired merge base for the current branch, defaulting to "origin/master". In so doing, subsequent `code-review` subcommands will have access to this and be able to default to a merge base branch instead of: * Having users specify one manually at the command line for each `code-review` subcommand * Having a default merge base branch that's not desired by users I figure I can hopefully get away with not sanitizing SQL input because I don't think you can use apostrophes in Git branch names. Otherwise I'll probably have to port this to another language with a SQLite library, as it doesn't seem possible to easily sanitize inputs in Bash.