diff options
author | Jeff King <peff@peff.net> | 2012-03-22 18:52:24 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-03-23 13:52:51 -0700 |
commit | 4f7cb99ada26be5d86402a6e060f3ee16a672f16 (patch) | |
tree | b12a4eed448bc55dca8463f5abe52eae37c8be94 /merge-recursive.c | |
parent | 90d43b07687fdc51d1f2fc14948df538dc45584b (diff) | |
download | git-4f7cb99ada26be5d86402a6e060f3ee16a672f16.tar.gz |
merge-recursive: don't detect renames of empty filesjk/diff-no-rename-empty
Merge-recursive detects renames so that if one side modifies
"foo" and the other side moves it to "bar", the modification
is applied to "bar". However, our rename detection is based
on content analysis, it can be wrong (i.e., two files were
not intended as a rename, but just happen to have the same
or similar content).
This is quite rare if the files actually contain content,
since two unrelated files are unlikely to have exactly the
same content. However, empty files present a problem, in
that there is nothing to analyze. An uninteresting
placeholder file with zero bytes may or may not be related
to a placeholder file with another name.
The result is that adding content to an empty file may cause
confusion if the other side of a merge removed it; your
content may end up in another random placeholder file that
was added.
Let's err on the side of caution and not consider empty
files as renames. This will cause a modify/delete conflict
on the merge, which will let the user sort it out
themselves.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r-- | merge-recursive.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/merge-recursive.c b/merge-recursive.c index 318d32e223..0fb174359a 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -485,6 +485,7 @@ static struct string_list *get_renames(struct merge_options *o, renames = xcalloc(1, sizeof(struct string_list)); diff_setup(&opts); DIFF_OPT_SET(&opts, RECURSIVE); + DIFF_OPT_CLR(&opts, RENAME_EMPTY); opts.detect_rename = DIFF_DETECT_RENAME; opts.rename_limit = o->merge_rename_limit >= 0 ? o->merge_rename_limit : o->diff_rename_limit >= 0 ? o->diff_rename_limit : |