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

[PATCH] git-gui: handle symlink replaced by file

From
Pat Thoyts <patthoyts@users.sourceforge.net>
Date
Oct 28, 2010, 12:27 UTC
Message-ID
<8739rqqb4m.fsf@fox.patthoyts.tk>
In-Reply-To
<AANLkTi=dA+mj1KDpAgGAtg1S5Gt5wXAJ4zLd-tLob=DH@mail.gmail.com>

If a symlink is replaced by a regular file an error message was emitted on stdout. This patch adds recognition of this case.

Reported-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
---
Bert Wesarg <bert.wesarg@googlemail.com> writes:
Show 19 quoted lines
>Hi,
>
>I get this error from git gui after I changed a symlink to a file:
>
>error: Unhandled 2 way diff marker: {d}
>
>To reproduce:
>
>$ git init
>$ ln -s bar foo
>$ git add foo
>$ git commit -m "add foo link"
>$ rm foo
>$ echo bar >foo
>$ git gui
>error: Unhandled 2 way diff marker: {d}
>
>I may have a look into this by my self in the long term, but maybe
>someone is faster than me.

This patch just handles the second segment without generating the error really. It doesn't attempt to do any pretty output.

 lib/diff.tcl |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/lib/diff.tcl b/lib/diff.tcl
index c628750..4d041fa 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -428,6 +428,14 @@ proc read_diff {fd cont_info} {
 					set tags d_+
 				}
 			}
+			{d} {
+				if {[string match {diff --git *} $line]} {
+					set ::current_diff_inheader 1
+					continue
+				} else {
+					puts "error: unrecognized operation: '$line'"
+				}
+			}
 			default {
 				puts "error: Unhandled 2 way diff marker: {$op}"
 				set tags {}
-- 
1.7.3.1.msysgit.0
Previous: Bert WesargNext: Bert Wesarg
Message 2 of 4 in “git-gui: 'Unhandled 2 way diff marker:' for typechanged path”
  1. Bert WesargOct 25, 2010
  2. git-gui: handle symlink replaced by filePat Thoyts, Oct 28, 2010
  3. Bert WesargNov 3, 2010
  4. Bert WesargDec 6, 2010

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.