summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2010-09-20 08:29:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-09-30 00:37:04 (GMT)
commita0de2f6bd3b79f7ab61ea90f795b964a7f7f3d6d (patch)
treef8f06b2f4d13cbb721a17892ee543d5b6265bdb7 /merge-recursive.c
parent71f7ffcc02a2f38436c59146b86897389130a538 (diff)
downloadgit-a0de2f6bd3b79f7ab61ea90f795b964a7f7f3d6d.zip
git-a0de2f6bd3b79f7ab61ea90f795b964a7f7f3d6d.tar.gz
git-a0de2f6bd3b79f7ab61ea90f795b964a7f7f3d6d.tar.bz2
conflict_rename_delete(): Check whether D/F conflicts are still present
If all the paths below some directory involved in a D/F conflict were not removed during the rest of the merge, then the contents of the file whose path conflicted needs to be recorded in file with an alternative filename. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index ffcecc7..09ce327 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -807,6 +807,8 @@ static void conflict_rename_delete(struct merge_options *o,
const char *other_branch)
{
char *dest_name = pair->two->path;
+ int df_conflict = 0;
+ struct stat st;
output(o, 1, "CONFLICT (rename/delete): Rename %s->%s in %s "
"and deleted in %s",
@@ -817,7 +819,13 @@ static void conflict_rename_delete(struct merge_options *o,
rename_branch == o->branch1 ? pair->two : NULL,
rename_branch == o->branch1 ? NULL : pair->two,
1);
+ if (lstat(dest_name, &st) == 0 && S_ISDIR(st.st_mode)) {
+ dest_name = unique_path(o, dest_name, rename_branch);
+ df_conflict = 1;
+ }
update_file(o, 0, pair->two->sha1, pair->two->mode, dest_name);
+ if (df_conflict)
+ free(dest_name);
}
static void conflict_rename_rename_1to2(struct merge_options *o,