completions/git: Handle git restore for unmerged file better
z3ntu opened this issue · comments
$ fish --version
fish, version 3.7.1
For files which git made a merge conflict of (e.g. after git stash pop
)
Unmerged paths:
(use "git restore --staged <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: drivers/phy/qualcomm/phy-qcom-qmp-combo.c
In this case git add
completion works correctly, but git restore
is a bit wrong. For just git restore <tab>
the file appears but when you run that command you get the error from git error: path 'drivers/phy/qualcomm/phy-qcom-qmp-combo.c' is unmerged
. As shown in git output above git restore --staged
needs to be used on that file, though for git restore --staged <tab>
fish completion doesn't complete that file.
So in short, remove this kind of unmerged file from git restore
and add it to git restore --staged
$ git status --porcelain=2
u UU N... 100644 100644 100644 100644 73328e6a821ac9a348ce00881b640a977541394a c21cdb8dbfe746061acea9b9ec1ab516d05cd3d3 9f42d94c0396a732cb54f4d65a34f3161b439236 drivers/phy/qualcomm/phy-qcom-qmp-combo.c
I can also work to get a "reproducer" to get a fresh repo into that kind of state, let me know if that's useful.