author | Junio C Hamano <gitster@pobox.com> | |
Wed, 27 Oct 2010 04:54:04 +0000 (21:54 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 27 Oct 2010 04:54:04 +0000 (21:54 -0700) |
* kb/merge-recursive-rename-threshold:
diff: add synonyms for -M, -C, -B
merge-recursive: option to specify rename threshold
Conflicts:
Documentation/diff-options.txt
Documentation/merge-strategies.txt
diff: add synonyms for -M, -C, -B
merge-recursive: option to specify rename threshold
Conflicts:
Documentation/diff-options.txt
Documentation/merge-strategies.txt
1 | 2 | |||
---|---|---|---|---|
Documentation/diff-options.txt | patch | | diff1 | | diff2 | | blob | history |
Documentation/merge-strategies.txt | patch | | diff1 | | diff2 | | blob | history |
diff.c | patch | | diff1 | | diff2 | | blob | history |
diff.h | patch | | diff1 | | diff2 | | blob | history |
merge-recursive.c | patch | | diff1 | | diff2 | | blob | history |
merge-recursive.h | patch | | diff1 | | diff2 | | blob | history |
diff --cc Documentation/diff-options.txt
index e954af0ad6c20707c2bf950a021fa1296e2582ea,df37ccd36572ea682ccebd67c1e8dccc217add79..bfd0b571e23a6b6ee21d9616466acd82795eed6c
the diff-patch output format. Non default number of
digits can be specified with `--abbrev=<n>`.
--B::
+-B[<n>][/<m>]::
+ --break-rewrites[=[<n>][/<m>]]::
- Break complete rewrite changes into pairs of delete and create.
-
--M::
+ Break complete rewrite changes into pairs of delete and
+ create. This serves two purposes:
++
+It affects the way a change that amounts to a total rewrite of a file
+not as a series of deletion and insertion mixed together with a very
+few lines that happen to match textually as the context, but as a
+single deletion of everything old followed by a single insertion of
+everything new, and the number `m` controls this aspect of the -B
+option (defaults to 60%). `-B/70%` specifies that less than 30% of the
+original should remain in the result for git to consider it a total
+rewrite (i.e. otherwise the resulting patch will be a series of
+deletion and insertion mixed together with context lines).
++
+When used with -M, a totally-rewritten file is also considered as the
+source of a rename (usually -M only considers a file that disappeared
+as the source of a rename), and the number `n` controls this aspect of
+the -B option (defaults to 50%). `-B20%` specifies that a change with
+addition and deletion compared to 20% or more of the file's size are
+eligible for being picked up as a possible source of a rename to
+another file.
+
+-M[<n>]::
+ --detect-renames[=<n>]::
ifndef::git-log[]
Detect renames.
endif::git-log[]
For following files across renames while traversing history, see
`--follow`.
endif::git-log[]
+ If `n` is specified, it is a is a threshold on the similarity
+ index (i.e. amount of addition/deletions compared to the
+ file's size). For example, `-M90%` means git should consider a
+ delete/add pair to be a rename if more than 90% of the file
+ hasn't changed.
--C::
+-C[<n>]::
+ --detect-copies[=<n>]::
Detect copies as well as renames. See also `--find-copies-harder`.
+ If `n` is specified, it has the same meaning as for `-M<n>`.
ifndef::git-format-patch[]
---diff-filter=[ACDMRTUXB*]::
+--diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]]::
Select only files that are Added (`A`), Copied (`C`),
Deleted (`D`), Modified (`M`), Renamed (`R`), have their
type (i.e. regular file, symlink, submodule, ...) changed (`T`),
diff --cc Documentation/merge-strategies.txt
index 9cf88e2bb5baa51c334e6d7232f926b49aef3681,77f26061d66fa24c57e169e75cff542e1223e12e..595a3cf1a7118ba29a1d57d7fc17d233d89cd3d0
Disables the `renormalize` option. This overrides the
`merge.renormalize` configuration variable.
-subtree[=path];;
+ rename-threshold=<n>;;
+ Controls the similarity threshold used for rename detection.
+ See also linkgit:git-diff[1] `-M`.
+
+subtree[=<path>];;
This option is a more advanced form of 'subtree' strategy, where
the strategy makes a guess on how two trees must be shifted to
match with each other when merging. Instead, the specified path
diff --cc diff.c
index ba57bfab1748ea6a6401105421d298c236bc7ef3,85a7fb02f0777692151cad28f4e02f3f26918591..d1c6b91982ccbb6489c57c9bbddb692c7b4b7ca3
+++ b/diff.c
options->output_format |= DIFF_FORMAT_NAME_STATUS;
else if (!strcmp(arg, "-s"))
options->output_format |= DIFF_FORMAT_NO_OUTPUT;
- else if (!prefixcmp(arg, "--stat")) {
- char *end;
- int width = options->stat_width;
- int name_width = options->stat_name_width;
- arg += 6;
- end = (char *)arg;
-
- switch (*arg) {
- case '-':
- if (!prefixcmp(arg, "-width="))
- width = strtoul(arg + 7, &end, 10);
- else if (!prefixcmp(arg, "-name-width="))
- name_width = strtoul(arg + 12, &end, 10);
- break;
- case '=':
- width = strtoul(arg+1, &end, 10);
- if (*end == ',')
- name_width = strtoul(end+1, &end, 10);
- }
-
- /* Important! This checks all the error cases! */
- if (*end)
- return 0;
- options->output_format |= DIFF_FORMAT_DIFFSTAT;
- options->stat_name_width = name_width;
- options->stat_width = width;
- }
+ else if (!prefixcmp(arg, "--stat"))
+ /* --stat, --stat-width, or --stat-name-width */
+ return stat_opt(options, av);
/* renames options */
- else if (!prefixcmp(arg, "-B")) {
+ else if (!prefixcmp(arg, "-B") || !prefixcmp(arg, "--break-rewrites=") ||
+ !strcmp(arg, "--break-rewrites")) {
if ((options->break_opt = diff_scoreopt_parse(arg)) == -1)
return -1;
}
diff --cc diff.h
Simple merge
diff --cc merge-recursive.c
Simple merge
diff --cc merge-recursive.h
Simple merge