git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] Tell multi-parent diff about core.symlinks.

From
Johannes Sixt <johannes.sixt@telecom.at>
Date
Mar 3, 2007, 19:38 UTC
Message-ID
<200703032038.00928.johannes.sixt@telecom.at>
In-Reply-To
<200703032032.47158.johannes.sixt@telecom.at>

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>
---

I'm not quite sure whether this patch is worth it. The only thing it seems to do is to avoid the mode change line (this is after a merge where 'symlink' had a conflict):

without the patch:
  $ git diff
  diff --cc symlink
  index 1a010b1,30d67d4..0000000
  mode 120000,120000..100644
  --- a/symlink
  +++ b/symlink
with the patch:
  $ git diff
  diff --cc symlink
  index 1a010b1,30d67d4..0000000
  --- a/symlink
  +++ b/symlink
 combine-diff.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/combine-diff.c b/combine-diff.c
index 044633d..e6e3969 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -699,8 +699,18 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
 			 !fstat(fd, &st)) {
 			size_t len = st.st_size;
 			size_t sz = 0;
+			int is_file, i;
 
 			elem->mode = canon_mode(st.st_mode);
+			/* if symlinks don't work, assume symlink if all parents
+			 * are symlinks
+			 */
+			is_file = has_symlinks;
+			for (i = 0; !is_file && i < num_parent; i++)
+				is_file = !S_ISLNK(elem->parent[i].mode);
+			if (!is_file)
+				elem->mode = canon_mode(S_IFLNK);
+
 			result_size = len;
 			result = xmalloc(len + 1);
 			while (sz < len) {
-- 
1.5.0.2.4.gdd4e4-dirty
Previous: Johannes SixtNext: Johannes Schindelin
Message 2 of 7 in “Handle core.symlinks=false case in merge-recursive.”
  1. 1/2 Handle core.symlinks=false case in merge-recursive.Johannes Sixt, Mar 3, 2007
  2. 2/2 Tell multi-parent diff about core.symlinks.Johannes Sixt, Mar 3, 2007
  3. Johannes SchindelinMar 3, 2007
  4. Johannes SixtMar 3, 2007
  5. Johannes SchindelinMar 3, 2007
  6. Johannes SixtMar 3, 2007
  7. Junio C HamanoMar 4, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.