@matheusbsbs / matheus-bagliano / commits / cf958afd83
Fork 0

Document -B<n>[/<m>], -M<n> and -C<n> variants of -B, -M and -C

These options take an optional argument, but this optional argument was not documented. Original patch by Matthieu Moy, but documentation for -B mostly copied from the explanations of Junio C Hamano. While we're there, fix a typo in a comment in diffcore.h. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Matthieu Moy committed Aug 5, 2010 at 18:14 UTC cf958afd8368ebce1cabb2f7ae2799306cc2de03
2 files changed +31 -6
Documentation/diff-options.txt
+30 -5
@@ -206,10 +206,29 @@ endif::git-format-patch[]
206 the diff-patch output format. Non default number of
207 digits can be specified with `--abbrev=<n>`.
208
209 --B::
210 - Break complete rewrite changes into pairs of delete and create.
211 -
212 --M::
209 +-B[<n>][/<m>]::
210 + Break complete rewrite changes into pairs of delete and
211 + create. This serves two purposes:
212 ++
213 +It affects the way a change that amounts to a total rewrite of a file
214 +not as a series of deletion and insertion mixed together with a very
215 +few lines that happen to match textually as the context, but as a
216 +single deletion of everything old followed by a single insertion of
217 +everything new, and the number `m` controls this aspect of the -B
218 +option (defaults to 60%). `-B/70%` specifies that less than 30% of the
219 +original should remain in the result for git to consider it a total
220 +rewrite (i.e. otherwise the resulting patch will be a series of
221 +deletion and insertion mixed together with context lines).
222 ++
223 +When used with -M, a totally-rewritten file is also considered as the
224 +source of a rename (usually -M only considers a file that disappeared
225 +as the source of a rename), and the number `n` controls this aspect of
226 +the -B option (defaults to 50%). `-B20%` specifies that a change with
227 +addition and deletion compared to 20% or more of the file's size are
228 +eligible for being picked up as a possible source of a rename to
229 +another file.
230 +
231 +-M[<n>]::
232 ifndef::git-log[]
233 Detect renames.
234 endif::git-log[]
@@ -218,9 +237,15 @@ ifdef::git-log[]
237 For following files across renames while traversing history, see
238 `--follow`.
239 endif::git-log[]
240 + If `n` is specified, it is a is a threshold on the similarity
241 + index (i.e. amount of addition/deletions compared to the
242 + file's size). For example, `-M90%` means git should consider a
243 + delete/add pair to be a rename if more than 90% of the file
244 + hasn't changed.
245
222 --C::
246 +-C[<n>]::
247 Detect copies as well as renames. See also `--find-copies-harder`.
248 + If `n` is specified, it has the same meaning as for `-M<n>`.
249
250 ifndef::git-format-patch[]
251 --diff-filter=[ACDMRTUXB*]::
diffcore.h
+1 -1
@@ -18,7 +18,7 @@
18 #define MAX_SCORE 60000.0
19 #define DEFAULT_RENAME_SCORE 30000 /* rename/copy similarity minimum (50%) */
20 #define DEFAULT_BREAK_SCORE 30000 /* minimum for break to happen (50%) */
21 -#define DEFAULT_MERGE_SCORE 36000 /* maximum for break-merge to happen 60%) */
21 +#define DEFAULT_MERGE_SCORE 36000 /* maximum for break-merge to happen (60%) */
22
23 #define MINIMUM_BREAK_SIZE 400 /* do not break a file smaller than this */
24