From 42215fe2bbefba19308bd879f6507123d53d1fe1 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 17 Jun 2019 20:05:47 +0200 Subject: 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. --- code-review-database | 4 ++-- 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) -- cgit v1.2.3