Commit d3530fa9 authored by Aaron Schrab's avatar Aaron Schrab Committed by Kai Willadsen

Fix git file comparison with mnemonic prefixes (closes bgo#663050)

If the git config setting diff.mnemonicprefix is set, that causes git
diff to use prefixes that indicate what is being compared rather than
always using "a" and "b". For the way that meld invokes git diff, the
prefixes will always be "c" for commit (HEAD) and and "w" for the work
tree. This confuses the patch parser and prevents the modified files
from being copied to the temporary directory, which then results in
patch failing to reverse the changes.

This patch fixes this by modifying the regular expression used to find
index entries in the patch to accept "c" and "w" as prefixes as well as
"a" and "b".
parent 95c5360b
......@@ -37,7 +37,7 @@ class Vc(_vc.CachedVc):
NAME = "Git"
VC_DIR = ".git"
PATCH_INDEX_RE = "^diff --git a/(.*) b/.*$"
PATCH_INDEX_RE = "^diff --git [ac]/(.*) [bw]/.*$"
state_map = {
"X": _vc.STATE_NONE, # Unknown
"A": _vc.STATE_NEW, # New
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment