Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Patches for files without newline at the end are not appliable by git apply #936

Closed
@distorhead

Description

@distorhead

Go-git generates broken diff-s for files without newline at the end. These patches cannot be applied by git apply command.

Original git diff command will generate patch with special line \ No newline at end of file marker.

Here is repo with example program in main.go: https://github.com/flant/go-git-test-2.

git clone https://github.com/flant/go-git-test-2 /tmp/go-git-test-2
cd /tmp/go-git-test-2
go build ./main.go
./main > bad.patch
git checkout c73fd0c6d5669affde76a78c60e4cc372d39abc1
git apply bad.patch

Gives:

error: patch failed: README.md:1
error: README.md: patch does not apply

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions