Skip to content
Snippets Groups Projects
Commit 4e262693 authored by Andy Stewart's avatar Andy Stewart
Browse files

Handle file moves for quickfix

Do not assume the new name (`fnamer`) is the same length as the old
name (`fnamel`).

Also use the new name rather than the old name when populating the
quickfix list.

See #872.
parent 986228fa
Branches
No related tags found
No related merge requests found
......@@ -222,13 +222,11 @@ function! gitgutter#quickfix(current_file)
let lnum = 0
for line in diff
if line =~ '^diff --git [^"]'
let paths = line[11:]
let mid = (len(paths) - 1) / 2
let [fnamel, fnamer] = [paths[:mid-1], paths[mid+1:]]
let fname = fnamel ==# fnamer ? fnamel : fnamel[2:]
let [fnamel, fnamer] = split(line)[2:3]
let fname = fnamel ==# fnamer ? fnamer : fnamer[2:]
elseif line =~ '^diff --git "'
let [_, fnamel, _, fnamer] = split(line, '"')
let fname = fnamel ==# fnamer ? fnamel : fnamel[2:]
let fname = fnamel ==# fnamer ? fnamer : fnamer[2:]
elseif line =~ '^diff --cc [^"]'
let fname = line[10:]
elseif line =~ '^diff --cc "'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment