Tell multi-parent diff about core.symlinks.
When core.symlinks is false, and a merge of symbolic links had conflicts, the merge result is left as a file in the working directory. A decision must be made whether the file is treated as a regular file or as a symbolic link. This patch treats the file as a symbolic link only if all merge parents were also symbolic links. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <junkio@cox.net>
Johannes Sixt committed
Mar 3, 2007 at 20:38 UTC
a249a9b5a26e841a28f6e993a560d749303cf91c
1 file changed
+10
combine-diff.c
+10
@@ -699,8 +699,18 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
699
!fstat(fd, &st)) {
700
size_t len = st.st_size;
701
size_t sz = 0;
702
+ int is_file, i;
703
704
elem->mode = canon_mode(st.st_mode);
705
+ /* if symlinks don't work, assume symlink if all parents
706
+ * are symlinks
707
+ */
708
+ is_file = has_symlinks;
709
+ for (i = 0; !is_file && i < num_parent; i++)
710
+ is_file = !S_ISLNK(elem->parent[i].mode);
711
+ if (!is_file)
712
+ elem->mode = canon_mode(S_IFLNK);
713
+
714
result_size = len;
715
result = xmalloc(len + 1);
716
while (sz < len) {