jesseduffield / jesseduffield/lazygit

Can't stage lines when using custom textconv diff driver

Open
#4,196 0 comments 3 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

**Describe the bug**
Can't stage lines when using custom textconv diff driver. Either garbage gets applied or an error appears.

```
error: patch failed: cp866.txt:1
error: cp866.txt: patch does not apply
```

**To Reproduce**
Steps to reproduce the behavior:

1. Set up a custom textconv driver in your gitconfig
```gitconfig
[diff "my-diff-cp866"]
textconv = "iconv -f cp866"
```
2. `cd "$(mktemp -d)" && echo "*.txt text diff=my-diff-cp866" >> .gitattributes && git init && echo -e "КОТ1\\nКОТ2" > utf8.txt && echo -e "КОТ1\\nКОТ2" | iconv -t cp866 > cp866.txt`
3. `lazygit` and try to stage lines in cp866.txt and utf8.txt
First time stages garbage. Second time gives an error.

**Expected behavior**
A line is staged.

**Screenshots**
-

**Version info:**
`commit=, build date=, build source=nix, version=0.45.0, os=linux, arch=amd64, git version=2.47.0`

**Additional context**
Perhaps wherever lazygit invokes git-diff with `--no-ext-diff` it should also use `--no-textconv`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.