git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] diff: make -M -C mean the same as -C -M
@ 2015-01-23  2:07 Mike Hommey
  2015-01-23 18:41 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Hommey @ 2015-01-23  2:07 UTC (permalink / raw)
  To: gitster; +Cc: git

While -C implies -M, it is quite common to see both on example command lines
here and there. The unintuitive thing is that if -M appears after -C, then
copy detection is turned off because of how the command line arguments are
handled.

Change this so that when both -C and -M appear, whatever their order, copy
detection is on.

Signed-off-by: Mike Hommey <mh@glandium.org>
---

Interestingly, I even found mentions of -C -M in this order for benchmarks,
on this very list (see 6555655.XSJ9EnW4BY@mako).

 diff.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/diff.c b/diff.c
index d1bd534..9081fd8 100644
--- a/diff.c
+++ b/diff.c
@@ -3670,7 +3670,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
 		 !strcmp(arg, "--find-renames")) {
 		if ((options->rename_score = diff_scoreopt_parse(arg)) == -1)
 			return error("invalid argument to -M: %s", arg+2);
-		options->detect_rename = DIFF_DETECT_RENAME;
+		if (options->detect_rename != DIFF_DETECT_COPY)
+			options->detect_rename = DIFF_DETECT_RENAME;
 	}
 	else if (!strcmp(arg, "-D") || !strcmp(arg, "--irreversible-delete")) {
 		options->irreversible_delete = 1;
-- 
2.2.2.2.g806f5e2.dirty

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-23 22:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-23  2:07 [PATCH] diff: make -M -C mean the same as -C -M Mike Hommey
2015-01-23 18:41 ` Junio C Hamano
2015-01-23 22:26   ` Mike Hommey
2015-01-23 22:34     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).