Commits

ZyX_I committed 47afe1e

Add git.strip

  • Participants
  • Parent commits 76d265f

Comments (0)

Files changed (1)

autoload/aurum/drivers/git.vim

             \'branchf': 'Failed to get list of branches '.
             \           'from the repository %s: %s',
             \  'grepf': 'Failed to search through the repository %s: %s',
+            \ 'stripf': 'Failed to strip revision %s from %s: %s',
             \   'tagf': 'Failed to get list of tags from the repository %s: %s',
             \   'addf': 'Failed to add file %s to the repository %s: %s',
             \ 'cbnimp': 'Git driver is not able to close branch',
             \'uresrev': 'Don’t know how to resolve %s into a commit object. '.
             \           'Occured when resolving %s in the repository %s',
             \ 'nohead': 'Failed to obtain HEAD revision in the repository %s',
+            \ 'sfnsup': 'Forced strip is not supported',
         \}
 let s:git={}
 let s:_options={
     return s:_r.utils.usefile(a:repo, a:message, 'file', 'message',
                 \             s:F.gitm, args, kwargs, 0, 'cif')
 endfunction
+"▶1 git.strip :: [rev[, force]]
+function s:git.strip(...)
+    let args=[(a:0 && !empty(a:1))?(a:1):('HEAD^')]
+    if a:0>1 && !empty(a:2)
+        call s:_f.throw('sfnsup')
+    endif
+    return s:F.gitm(a:repo, 'reset', args, {}, 0, 'stripf', args[0])
+endfunction
 "▶1 git.branch :: repo, branchname, force → + FS
 function s:git.branch(repo, branch, force)
     if a:force