Skip to content

Commit

Permalink
vim: metarw: Change return value for content browser buffer
Browse files Browse the repository at this point in the history
Change return value from metarw#{scheme}#read() to set up content browser
buffer - a dictionary instead of a list.  This change is for further work to
give more information to metarw from {scheme}.
  • Loading branch information
kana committed Mar 28, 2010
1 parent e815e34 commit 453cf3c
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions autoload/metarw/git.vim
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,20 @@ function! metarw#git#read(fakepath) "{{{2
if _.incomplete_path == '' || _.incomplete_path[-1:] == '/'
" "git:{commit-ish}:" OR "git:{commit-ish}:{tree}/"?
let parent_path = join(split(_.leading_path, '/', !0)[:-2], '/')
let result = [{
\ 'label': '../',
\ 'fakepath': (_.incomplete_path == ''
\ ? printf('%s:', _.scheme)
\ : printf('%s:%s:%s',
\ _.scheme,
\ _.given_commit_ish,
\ parent_path . (parent_path == '' ? '' : '/'))),
\ }]
let result = {}
let result.items = [{
\ 'label': '../',
\ 'fakepath': (_.incomplete_path == ''
\ ? printf('%s:', _.scheme)
\ : printf('%s:%s:%s',
\ _.scheme,
\ _.given_commit_ish,
\ parent_path . (parent_path=='' ? '' : '/'))),
\ }]
for object in s:git_ls_tree(_.commit_ish, _.incomplete_path)
let path = object.path . (object.type ==# 'tree' ? '/' : '')
let prefix_length = (_.leading_path == '' ? 0 : len(_.leading_path)+1)
call add(result, {
call add(result.items, {
\ 'label': path[(prefix_length):],
\ 'fakepath': printf('%s:%s:%s',
\ _.scheme,
Expand All @@ -92,12 +93,13 @@ function! metarw#git#read(fakepath) "{{{2
execute 'read !git show' _.commit_ish
let result = 0
else
let result = [{
let result = {}
let result.items = [{
\ 'label': './',
\ 'fakepath': a:fakepath,
\ }]
for branch_name in s:git_branches()
call add(result, {
call add(result.items, {
\ 'label': branch_name,
\ 'fakepath': printf('%s:%s:', _.scheme, branch_name),
\ })
Expand Down

0 comments on commit 453cf3c

Please sign in to comment.