Merge branch 'js/range-diff-one-side-only'

The "git range-diff" command learned "--(left|right)-only" option
to show only one side of the compared range.

* js/range-diff-one-side-only:
  range-diff: offer --left-only/--right-only options
  range-diff: move the diffopt initialization down one layer
  range-diff: combine all options in a single data structure
  range-diff: simplify code spawning `git log`
  range-diff: libify the read_patches() function again
  range-diff: avoid leaking memory in two error code paths
This commit is contained in:
Junio C Hamano
2021-02-17 17:21:41 -08:00
7 changed files with 120 additions and 61 deletions

View File

@ -733,4 +733,19 @@ test_expect_success 'format-patch --range-diff with multiple notes' '
test_cmp expect actual
'
test_expect_success '--left-only/--right-only' '
git switch --orphan left-right &&
test_commit first &&
test_commit unmatched &&
test_commit common &&
git switch -C left-right first &&
git cherry-pick common &&
git range-diff -s --left-only ...common >actual &&
head_oid=$(git rev-parse --short HEAD) &&
common_oid=$(git rev-parse --short common) &&
echo "1: $head_oid = 2: $common_oid common" >expect &&
test_cmp expect actual
'
test_done