[PATCH 5/5] diff-merges: issue warning on lone '-m' option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lone '-m' is in use by scripts/aliases that aim at enabling diff
output for merge commits, but only if '-p' is then specified as well.

As '-m' may now be configured to imply '-p', using
'log.diffMerges-m-imply-p', issue warning and suggest to instead use

  --diff-merges=on,hide

that does not depend on user configuration.

Signed-off-by: Sergey Organov <sorganov@xxxxxxxxx>
---
 diff-merges.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/diff-merges.c b/diff-merges.c
index ddf9a411c49c..b3b3c9e44ba8 100644
--- a/diff-merges.c
+++ b/diff-merges.c
@@ -11,6 +11,7 @@ static diff_merges_setup_func_t force_func = NULL;
 static int suppress_m_parsing;
 static int hide = 0;
 static int m_imply_p = 0;
+static int got_m = 0;
 
 static void suppress(struct rev_info *revs)
 {
@@ -196,6 +197,7 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
 		set_to_default(revs);
 		set_hide(revs);
 		revs->merges_imply_patch = m_imply_p;
+		got_m = 1;
 	} else if (!strcmp(arg, "-c")) {
 		set_func = set_combined;
 	} else if (!strcmp(arg, "--cc")) {
@@ -259,5 +261,7 @@ void diff_merges_setup_revs(struct rev_info *revs)
 	if (revs->merges_imply_patch || revs->merges_need_diff) {
 		if (!revs->diffopt.output_format)
 			revs->diffopt.output_format = DIFF_FORMAT_PATCH;
-	}
+	} else if (got_m)
+		warning(_("legacy use of lone '-m' detected: please use '--diff-merges=on,hide' instead, as '-m' may imply '-p'"));
+
 }
-- 
2.37.3.526.g5f84746cb16b




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux