aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--range-diff.c3
-rwxr-xr-xt/t3206-range-diff.sh23
2 files changed, 2 insertions, 24 deletions
diff --git a/range-diff.c b/range-diff.c
index 1e72928f02..014112ee40 100644
--- a/range-diff.c
+++ b/range-diff.c
@@ -433,7 +433,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;
diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh
index 08b0fddf24..097ce34f84 100755
--- a/t/t3206-range-diff.sh
+++ b/t/t3206-range-diff.sh
@@ -134,43 +134,20 @@ test_expect_success 'changed commit with --no-patch diff option' '
'
test_expect_success 'changed commit with --stat diff option' '
- four_spaces=" " &&
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(-)
- $four_spaces
2: fccce22 = 2: f51d370 s/4/A/
a => b | 0
1 file changed, 0 insertions(+), 0 deletions(-)
- $four_spaces
3: 147e64e ! 3: 0559556 s/11/B/
a => b | 0
1 file changed, 0 insertions(+), 0 deletions(-)
- $four_spaces
- @@ -10,7 +10,7 @@
- 9
- 10
- -11
- -+B
- ++BB
- 12
- 13
- 14
4: a63e992 ! 4: d966c5c s/12/B/
a => b | 0
1 file changed, 0 insertions(+), 0 deletions(-)
- $four_spaces
- @@ -8,7 +8,7 @@
- @@
- 9
- 10
- - B
- + BB
- -12
- +B
- 13
EOF
test_cmp expected actual
'