Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
Qt Creator 3.3.0
-
None
-
18b1d9270d49a49c713cf75dffad9cdcf3a93edd
Description
Steps to reproduce:
- Open a file in a Git repository
- Make a modification (anything)
- Get the diff (e.g., Alt+G, D)
- Right-click on the chunk, select Revert Chunk
- Confirm
Expected result: the reversal succeeds and the change is backed out of the repository.
Actual result: the change remains, the "General Messages" pane shows:
"/usr/bin/patch" failed (exit code 1). Executing in /home/thiago/src/qt/qt5/qtbase: /usr/bin/patch -p0 -R can't find file to patch at input line 3 Perhaps you used the wrong -p or --strip option? The text leading up to this was: -------------------------- |--- w/src/dbus/qdbusintegrator.cpp |+++ w/src/dbus/qdbusintegrator.cpp --------------------------
Note how the patch has a "w/" that shouldn't be there. To get away from it, one would need to use -p1, but Creator psased -p0 to patch.
It's possible that Creator assumes that Git always prints "a/" and "b/", which is an incorrect assumption. From git-config(1):
diff.mnemonicprefix If set, git diff uses a prefix pair that is different from the standard "a/" and "b/" depending on what is being compared. When this configuration is in effect, reverse diff output also swaps the order of the prefixes: git diff compares the (i)ndex and the (w)ork tree; git diff HEAD compares a (c)ommit and the (w)ork tree; git diff --cached compares a (c)ommit and the (i)ndex; git diff HEAD:file1 file2 compares an (o)bject and a (w)ork tree entity; git diff --no-index a b compares two non-git things (1) and (2). diff.noprefix If set, git diff does not show any source or destination prefix.