Skip to content

BUG: add-patch.c:870: unhandled diff marker: '\' #2364

Closed
@hlovdal

Description

@hlovdal
  • I was not able to find an open or closed issue matching what I'm seeing

Details

The function split_hunk in add-patch.c does not properly handle change in newline at the end of a file. When trying to split a diff at the end of a file to avoid including the newline change, the split command triggers a BUG macro and terminates.

$ git add -p
diff --git a/somefile.json b/somefile.json
index 8c2a6dad..78ea0292 100644
--- a/somefile.json
+++ b/somefile.json
@@ -21,7 +21,7 @@
       "aaaaaa": {
         "bbbbb": "cccccccc"
       },
-      "dddddd": "1111"
+      "dddddd": "2222"
     }
   }
-}
\ No newline at end of file
+}
Stage this hunk [y,n,q,a,d,s,e,?]? s
BUG: add-patch.c:870: unhandled diff marker: '\'

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options
git version 2.23.0.windows.1
cpu: x86_64
built from commit: 4db2e5cc9e1522131a039cbad3970f147a39f0ce
sizeof-long: 4
sizeof-size_t: 8
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver
Microsoft Windows [Version 10.0.18362.418]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
$ cat /etc/install-options.txt
Editor Option: VIM
Custom Editor Path:
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: LFOnly
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled
Enable Builtin Interactive Add: Enabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

This is specific to git-for-windows since add-patch.c is not present in upstream git.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions