Commits

ZyX_I committed 64ae745

@aurum/repo: Fixed getstats implementation: it now works for git
@aurum/drivers/git: Made rf-diffname() output 0 in case when filename was not found

Comments (0)

Files changed (3)

plugin/aurum/drivers/git.vim

 endfunction
 "▶1 git.diffname :: _, line, diffre, _ → rpath
 function s:git.diffname(repo, line, diffre, opts)
-    return s:F.refile(get(matchlist(a:line, a:diffre), 1, 0))[2:]
+    let file=get(matchlist(a:line, a:diffre), 1, 0)
+    if file is 0
+        return 0
+    else
+        return s:F.refile(file)[2:]
+    endif
 endfunction
 "▶1 nullnl :: [String] → [String]
 " Convert between lines (NL separated strings with NULLs represented as NLs) and 

plugin/aurum/repo.vim

     let llines=len(a:diff)
     let stats={'files': {}, 'insertions': 0, 'deletions': 0}
     let file=0
+    let pmlines=0
     while i<llines
         let line=a:diff[i]
-        if line[:3] is# 'diff'
-            let file=a:repo.functions.diffname(a:repo, line, diffre, a:opts)
-            if file isnot 0
-                let stats.files[file]={'insertions': 0, 'deletions': 0,}
-                let i+=1
-                let oldi=i
-                let pmlines=2
-                while pmlines && i<llines
-                    let lstart=a:diff[i][:2]
-                    if lstart is# '+++' || lstart is# '---'
-                        let pmlines-=1
-                    endif
-                    let i+=1
-                    if i-oldi>=4
-                        let i=oldi
-                        break
-                    endif
-                endwhile
-                continue
+        let newfile=a:repo.functions.diffname(a:repo, line, diffre, a:opts)
+        if newfile isnot 0
+            let file=newfile
+            let stats.files[file]={'insertions': 0, 'deletions': 0,}
+            let pmlines=2
+        elseif file is 0
+        elseif pmlines
+            let lstart=line[:2]
+            if lstart is# '+++' || lstart is# '---'
+                let pmlines-=1
             endif
-        elseif file is 0
         elseif line[0] is# '+'
             let stats.insertions+=1
             let stats.files[file].insertions+=1

Binary file modified.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.