1. ZyX_I
  2. aurum

Commits

ZyX_I  committed aace214

@%aurum/drivers/git: Made it do fast-forward merges on pull.
Fixed getrepoprop(, 'url') in case there is no push url
(broken when refactoring utils.run)

  • Participants
  • Parent commits e8d4a4b
  • Branches default

Comments (0)

Files changed (1)

File autoload/aurum/drivers/git.vim

View file
                     \        'branchf')[:-2]
         return get(filter(branches, 'v:val[0] is# "*"'), 0, '')[2:]
     elseif a:prop is# 'url'
-        let [r, exit_code]=get(s:F.git(a:repo, 'config',
-                    \                  ['remote.origin.pushurl'], {}, 0),
-                    \          0, 0)
+        let [l, exit_code]=s:F.git(a:repo, 'config',
+                    \              ['remote.origin.pushurl'], {}, 0, 0)
+        let r=get(l, 0, 0)
         if exit_code || r is 0
             let r=get(s:F.git(a:repo, 'config', ['remote.origin.url'], {}, 0),
                         \0, 0)
 endfunction
 "▶1 pushpull :: cmd, repo, dryrun, force[, URL[, rev]] → + ?
 function s:F.pushpull(cmd, repo, dryrun, force, ...)
-    let kwargs={'all': 1}
+    let kwargs1={}
+    let kwargs2={'all': 1}
+    let args=[]
+    let cmd=a:cmd
     let args=[]
     if a:0
         if a:1 isnot 0
             let args+=[a:2]
         endif
     endif
-    if (a:cmd is# 'fetch' && !empty(args)) || len(args)>2
-        unlet kwargs.all
+    if (a:cmd is# 'pull' && !empty(args)) || len(args)>2
+        unlet kwargs2.all
     endif
     if a:force
-        let kwargs.force=1
+        let kwargs2.force=1
     endif
     if a:dryrun
-        let kwargs['dry-run']=1
+        if cmd is# 'pull'
+            let cmd='fetch'
+        endif
+        let kwargs2['dry-run']=1
     endif
-    return s:F.gitm(a:repo, a:cmd, args, kwargs, 0, 'ppf', a:cmd)
+    if a:cmd is# 'pull'
+        let kwargs1['ff-only']=1
+    endif
+    let args=s:_r.utils.kwargstolst(kwargs1)+s:_r.utils.kwargstolst(kwargs2)
+                \+args
+    return s:F.gitm(a:repo, a:cmd, args, {}, 0, 'ppf', a:cmd)
 endfunction
 "▶1 git.push :: repo, dryrun, force[, URL[, rev]]
 function s:git.push(...)
 endfunction
 "▶1 git.pull :: repo, dryrun, force[, URL[, rev]]
 function s:git.pull(...)
-    return call(s:F.pushpull, ['fetch']+a:000, {})
+    return call(s:F.pushpull, ['pull']+a:000, {})
 endfunction
 "▶1 git.repo :: path → repo
 function s:git.repo(path)