diff options
author | Teddy Wing | 2019-06-17 20:05:47 +0200 |
---|---|---|
committer | Teddy Wing | 2019-06-17 20:05:47 +0200 |
commit | 42215fe2bbefba19308bd879f6507123d53d1fe1 (patch) | |
tree | 8d0a6fe8d3de61fbb7b29ddaa40aa309a3ccf39b | |
parent | 87b53c3468625eab072dbd80e983eb3b364d4a10 (diff) | |
download | code-review-42215fe2bbefba19308bd879f6507123d53d1fe1.tar.bz2 |
get_merge_base(): Change default base to `master...`
Add the range filter to try to remove commits that we don't care about.
Still not sure if this will work in all cases, as sometimes `..` seemed
to give me the right collection of files and sometimes `...` did.
code-review-difftool:
Pass the merge base without range dots (`..` or `...`) to Vim Fugitive,
as it doesn't accept revisions with ranges. Not sure what to do if I get
a range with two revision names yet, though.
Turns on Bash's `extglob` in order to use `?(...)` to include both
patterns in the expansion.
-rw-r--r-- | code-review-database | 4 | ||||
-rwxr-xr-x | code-review-difftool | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/code-review-database b/code-review-database index 5c931c6..3c3a1ee 100644 --- a/code-review-database +++ b/code-review-database @@ -70,10 +70,10 @@ function create_merge_base_from_current () { function get_merge_base () { local head="$(current_branch)" - local default_base='master' + local default_base='master...' if git config remote.origin.url > /dev/null; then - default_base='origin/master' + default_base='origin/master...' fi sqlite3 "$DATABASE" <<-SQL diff --git a/code-review-difftool b/code-review-difftool index b6c6b8e..7976d92 100755 --- a/code-review-difftool +++ b/code-review-difftool @@ -21,6 +21,16 @@ SCRIPT="$(dirname "$0")" source "$SCRIPT/code-review-database" +# shopt -s extglob +# echo "${y%%?(..|...)}" +# shopt -u extglob + + review_base="$(get_merge_base)" -vim -c "tabdo Gdiff $review_base" -p $(code-review changed-files) +# Remove dot ranges at the end of a revision as Fugitive doesn't support them. +shopt -s extglob +review_base_without_dots="${review_base%%?(..|...)}" +shopt -u extglob + +vim -c "tabdo Gdiff $review_base_without_dots" -p $(code-review changed-files) |