Merge branch 'ab/range-diff-no-patch'
The "--no-patch" option, which can be used to get a high-level overview without the actual line-by-line patch difference shown, of the "range-diff" command was earlier broken, which has been corrected. * ab/range-diff-no-patch: range-diff: make diff option behavior (e.g. --stat) consistent range-diff: fix regression in passing along diff options range-diff doc: add a section about output stabilitymaint
						commit
						a517079437
					
				|  | @ -78,6 +78,23 @@ between patches", i.e. to compare the author, commit message and diff of | |||
| corresponding old/new commits. There is currently no means to tweak the | ||||
| diff options passed to `git log` when generating those patches. | ||||
|  | ||||
| OUTPUT STABILITY | ||||
| ---------------- | ||||
|  | ||||
| The output of the `range-diff` command is subject to change. It is | ||||
| intended to be human-readable porcelain output, not something that can | ||||
| be used across versions of Git to get a textually stable `range-diff` | ||||
| (as opposed to something like the `--stable` option to | ||||
| linkgit:git-patch-id[1]). There's also no equivalent of | ||||
| linkgit:git-apply[1] for `range-diff`, the output is not intended to | ||||
| be machine-readable. | ||||
|  | ||||
| This is particularly true when passing in diff options. Currently some | ||||
| options like `--stat` can, as an emergent effect, produce output | ||||
| that's quite useless in the context of `range-diff`. Future versions | ||||
| of `range-diff` may learn to interpret such options in a manner | ||||
| specific to `range-diff` (e.g. for `--stat` producing human-readable | ||||
| output which summarizes how the diffstat changed). | ||||
|  | ||||
| CONFIGURATION | ||||
| ------------- | ||||
|  |  | |||
|  | @ -461,7 +461,8 @@ int show_range_diff(const char *range1, const char *range2, | |||
| 		struct strbuf indent = STRBUF_INIT; | ||||
|  | ||||
| 		memcpy(&opts, diffopt, sizeof(opts)); | ||||
| 		opts.output_format = DIFF_FORMAT_PATCH; | ||||
| 		if (!opts.output_format) | ||||
| 			opts.output_format = DIFF_FORMAT_PATCH; | ||||
| 		opts.flags.suppress_diff_headers = 1; | ||||
| 		opts.flags.dual_color_diffed_diffs = dual_color; | ||||
| 		opts.output_prefix = output_prefix_cb; | ||||
|  |  | |||
|  | @ -122,6 +122,36 @@ test_expect_success 'changed commit' ' | |||
| 	test_cmp expected actual | ||||
| ' | ||||
|  | ||||
| test_expect_success 'changed commit with --no-patch diff option' ' | ||||
| 	git range-diff --no-color --no-patch topic...changed >actual && | ||||
| 	cat >expected <<-EOF && | ||||
| 	1:  4de457d = 1:  a4b3333 s/5/A/ | ||||
| 	2:  fccce22 = 2:  f51d370 s/4/A/ | ||||
| 	3:  147e64e ! 3:  0559556 s/11/B/ | ||||
| 	4:  a63e992 ! 4:  d966c5c s/12/B/ | ||||
| 	EOF | ||||
| 	test_cmp expected actual | ||||
| ' | ||||
|  | ||||
| test_expect_success 'changed commit with --stat diff option' ' | ||||
| 	git range-diff --no-color --stat topic...changed >actual && | ||||
| 	cat >expected <<-EOF && | ||||
| 	1:  4de457d = 1:  a4b3333 s/5/A/ | ||||
| 	     a => b | 0 | ||||
| 	     1 file changed, 0 insertions(+), 0 deletions(-) | ||||
| 	2:  fccce22 = 2:  f51d370 s/4/A/ | ||||
| 	     a => b | 0 | ||||
| 	     1 file changed, 0 insertions(+), 0 deletions(-) | ||||
| 	3:  147e64e ! 3:  0559556 s/11/B/ | ||||
| 	     a => b | 0 | ||||
| 	     1 file changed, 0 insertions(+), 0 deletions(-) | ||||
| 	4:  a63e992 ! 4:  d966c5c s/12/B/ | ||||
| 	     a => b | 0 | ||||
| 	     1 file changed, 0 insertions(+), 0 deletions(-) | ||||
| 	EOF | ||||
| 	test_cmp expected actual | ||||
| ' | ||||
|  | ||||
| test_expect_success 'changed commit with sm config' ' | ||||
| 	git range-diff --no-color --submodule=log topic...changed >actual && | ||||
| 	cat >expected <<-EOF && | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Junio C Hamano
						Junio C Hamano