Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve fugitive integration #1603

Merged
merged 5 commits into from
Dec 21, 2017
Merged

Improve fugitive integration #1603

merged 5 commits into from
Dec 21, 2017

Conversation

Cimbali
Copy link
Contributor

@Cimbali Cimbali commented Nov 22, 2017

Fixes #1591 and improves display of git metadata of fugitive files, by showing:

  • filename stripped of fugitive://.../sha1// elements in status line
  • the sha1 or ref when opening a file from a different revision in a buffer
  • a reminder of the current checked out branch, thus 8d4355(master) for example

Also fix not recognizing files as part of repos correctly, when inside submodules.

It which requires a path, and just performed the same as
fugitive#head() does internally.
Only changes anything in the case of using fugitive to show a file that
is not from the current working directory.
The initial reason in #237 is not valid anymore, as vim-gitgutter
functions as expected for editing files that are not part of a repo,
whether they are:
- in a different repo
- in a parent repo (cwd being a submodule)
- outside of the repo

Furthermore, removing this check allows to show relevant info for
specific fugitive file names that are fugitive://..../sha1//...
which are hard to parse manually, especially in complicated situations
such as submodules.
@chrisbra
Copy link
Member

thanks, looks good. However I'd like to get some feedback before merging this.

@Cimbali
Copy link
Contributor Author

Cimbali commented Nov 23, 2017

Yeah, I'm not 100% sure about everything pertaining to the new airline#extensions#fugitiveline#bufname(). Maybe caching the results if we need more performance? Should we need to account for dynamic changes in &autochdir ?


function! s:update_git_branch(path)
" Fugitive special revisions. call '0' "staging" ?
let s:names = {'0': 'index', '1': 'ancestor', '2':'target', '3':'merged'}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After using this for a couple of days, I think the names used in merging are confusing. But then again, I virtually never merge, I always rebase, so if someone could look at if that makes sense. '0':'index' is fine, and I've gotten the other values from :help fugitive-revision

@Cimbali
Copy link
Contributor Author

Cimbali commented Nov 30, 2017

Another thing that could be useful with per-buffer VCS information is to display it even for non-active buffers. Otherwise I've found this feature to smoothen my daily workflow quite a lot.

Maybe showing something like working-tree or tree explicitely rather than nothing can be interesting too. That way the format is always file-ref(branch-ref) where file-ref can be special value.

@chrisbra
Copy link
Member

I am going to merge this. Let's see what happens :)

@academician
Copy link

Also fixes #1607.

@zhifengle
Copy link

I update my vim-airline to this commit, it would infinitly run a command on git diff mode created by fugitive gitcommit window. I'm not sure it is diff or not. I just see task bar on bottom flashing a window.
If I reset commit to previous one, it would be OK!

OS: Windows 7
Gvim version: vim8.0.1358-x64 vim8.0.1420-x64

@Cimbali
Copy link
Contributor Author

Cimbali commented Dec 23, 2017

I straced my vim on linux with and the only repeated commands I see are some git rev-parse calls.
These seem to be called from the airline status bar.
Could you run this command in your vim, see if it causes your task bar to blink?

:echo fugitive#buffer().repo().translate(fugitive#buffer().path())

The only 2 other calls are in branch.vim, fugitive#head() which was already there and consists of reading the .git/HEAD file, and fugitive#buffer().commit() which consists of parsing the fugitive://<repo path>//<sha1>/<file path in repo> filename.

@zhifengle
Copy link

:echo fugitive#buffer().repo().translate(fugitive#buffer().path())

It would be OK after run this command. This issue seems describes same problem. #1618

I had checked the recent commit. This commit 33663d7 will cause the problem.

@Cimbali
Copy link
Contributor Author

Cimbali commented Dec 26, 2017

@22earth Does #1620 fix this for you?

@zhifengle
Copy link

@Cimbali Now, it's OK. THX!

YCbCr pushed a commit to YCbCr/vim-airline that referenced this pull request May 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Further fugitive integration
4 participants