Skip to content

Commit a249a9b

Browse files
Johannes SixtJunio C Hamano
authored andcommitted
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>
1 parent 723024d commit a249a9b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

combine-diff.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,18 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
699699
!fstat(fd, &st)) {
700700
size_t len = st.st_size;
701701
size_t sz = 0;
702+
int is_file, i;
702703

703704
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+
704714
result_size = len;
705715
result = xmalloc(len + 1);
706716
while (sz < len) {

0 commit comments

Comments
 (0)