Skip to content

Range diff with ranges lacking dotdot

Johannes Schindelin via GitGitGadget git 6 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest3 patches 0 repliesNew
  2. v53 patches 3 repliesSuperseded
  3. v43 patches 9 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v33 patches0 repliesSuperseded
v23 patches10 repliesSuperseded
v13 patches17 repliesSuperseded

Changes in v6 from the cover letter

* The commit marks are now cleared in a separate loop.
* The regression test no longer looks only for "rang" but for "range" in the error message.
* We now pass NULL as opt parameter to setup_revisions(), not 0.

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3range-diff/format-patch: refactor check for commit rangebuiltin/log.c builtin/range-diff.c range-diff.c +1 more+19 -50 replies
2/3range-diff/format-patch: handle commit ranges other than A..Brange-diff.c range-diff.h t/t3206-range-diff.sh+39 -40 replies
3/3range-diff(docs): explain how to specify commit rangesDocumentation/git-range-diff.txt+11 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.

Read the v6 thread

Cover letter [PATCH v6 0/3] Range diff with ranges lacking dotdot

In
https://lore.kernel.org/git/[email protected]/,
it was reported that git range-diff does not handle commit ranges like rev^!. This patch series fixes that.

Changes since v5:

* The commit marks are now cleared in a separate loop.
* The regression test no longer looks only for "rang" but for "range" in the error message.
* We now pass NULL as opt parameter to setup_revisions(), not 0.

Changes since v4:

* The commit marks are now cleared in is_range_diff_range().
* A regression test now verifies that HEAD^{/something..or other} isn't mistaken for a commit range.
* The manual page no longer mentions "symmetric range", to avoid contentious language.

Changes since v3:

* The revision machinery is now used directly to validate the commit ranges.

Changes since v2:

* Move the helper function from revision.c to range-diff.c and rename it.
* Use a regex to make it easier to understand what we're trying to match.
* Fix the documentation that claimed that we used git merge-base internally when git range-diff parses ...-style arguments, which is not the case.

Changes since v1:

* In addition to git range-diff, git format-patch --range-diff gets the same improvement.
* The comment talking about ^@ was removed.
* The parsing was made a bit safer (e.g. catching ! by its own as an invalid range).

Johannes Schindelin (3):
range-diff/format-patch: refactor check for commit range range-diff/format-patch: handle commit ranges other than A..B range-diff(docs): explain how to specify commit ranges

 Documentation/git-range-diff.txt | 11 +++++++++++
 builtin/log.c                    |  2 +-
 builtin/range-diff.c             |  9 +++++----
 range-diff.c                     | 29 +++++++++++++++++++++++++++++
 range-diff.h                     |  6 ++++++
 t/t3206-range-diff.sh            | 13 +++++++++++++
 6 files changed, 65 insertions(+), 5 deletions(-)

base-commit: 71ca53e8125e36efbda17293c50027d31681a41f
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-841%2Fdscho%2Frange-diff-with-ranges-lacking-dotdot-v6
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-841/dscho/range-diff-with-ranges-lacking-dotdot-v6
Pull-Request: https://github.com/gitgitgadget/git/pull/841

Range-diff vs v5:

 1:  b98fa94b8703 = 1:  b98fa94b8703 range-diff/format-patch: refactor check for commit range
 2:  04b5d75adbc3 ! 2:  f8e6a1ad9d3d range-diff/format-patch: handle commit ranges other than A..B
     @@ range-diff.c: int show_range_diff(const char *range1, const char *range2,
      +	struct rev_info revs;
      +
      +	init_revisions(&revs, NULL);
     -+	if (setup_revisions(3, argv, &revs, 0) == 1)
     -+		for (i = 0; i < revs.pending.nr; i++) {
     -+			struct object *obj = revs.pending.objects[i].item;
     -+
     -+			if (obj->flags & UNINTERESTING)
     ++	if (setup_revisions(3, argv, &revs, NULL) == 1) {
     ++		for (i = 0; i < revs.pending.nr; i++)
     ++			if (revs.pending.objects[i].item->flags & UNINTERESTING)
      +				negative++;
      +			else
      +				positive++;
     ++		for (i = 0; i < revs.pending.nr; i++) {
     ++			struct object *obj = revs.pending.objects[i].item;
     ++
      +			if (obj->type == OBJ_COMMIT)
      +				clear_commit_marks((struct commit *)obj,
      +						   ALL_REV_FLAGS);
      +		}
     ++	}
      +
      +	free(copy);
      +	object_array_clear(&revs.pending);
     @@ t/t3206-range-diff.sh: test_expect_success 'simple A B C (unmodified)' '
      +
      +test_expect_success 'A^{/..} is not mistaken for a range' '
      +	test_must_fail git range-diff topic^.. topic^{/..} 2>error &&
     -+	test_i18ngrep "not a commit rang" error
     ++	test_i18ngrep "not a commit range" error
      +'
      +
       test_expect_success 'trivial reordering' '

3: bc5de807735d = 3: 08c5f8732747 range-diff(docs): explain how to specify commit ranges

Signature · 1 line
gitgitgadget