Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
hlovdal opened this issue Oct 22, 2019 · 2 comments
Closed
1 task done

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

hlovdal opened this issue Oct 22, 2019 · 2 comments
Assignees

Comments

@hlovdal
Copy link

hlovdal commented Oct 22, 2019

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

@dscho
Copy link
Member

dscho commented Oct 22, 2019

Excellent find, thank you! I will work on a fix.

@dscho
Copy link
Member

dscho commented Oct 24, 2019

@hlovdal would you mind verifying that https://github.com/git-for-windows/git/releases/tag/v2.24.0-rc1.windows.1 fixes the bug on your side, too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants