Skip to contentSkip to conversation

git-gui: 'Unhandled 2 way diff marker:' for typechanged path

PATCH In review Bert Wesarg 2 participants 4 messages Jun 15, 2016 Library code

lore
Share & tools
lore
#0 lore raw

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.

Regards,
Bert

#1 lore raw

PATCH 1/1 git-gui: handle symlink replaced by file

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

---

Quoted 17 lines · Bert Wesarg

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}
Quoted 2 lines

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(-)
lib/diff.tcl +8 -0
index c628750..4d041fa 100644
@@ -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 {}
Signature · 1 line
1.7.3.1.msysgit.0
#2 lore raw

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

Quoted 2 lines · Pat Thoyts

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

Thanks for the patch. I haven't test it yet. Actually I can't find documentation, that git outputs two diffs when the path changes the type. And I have no idea how to present this in git gui.

Bert

#3 lore raw

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

Quoted 8 lines · Bert Wesarg
Quoted 2 lines · Pat Thoyts

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

Thanks for the patch. I haven't test it yet. Actually I can't find documentation, that git outputs two diffs when the path changes the type. And I have no idea how to present this in git gui.

I have a better fix for this. But haven't the time to send it yet.

Bert

Quoted 3 lines

Bert