Skip to content

Conversation

@linrongbin16
Copy link
Owner

@linrongbin16 linrongbin16 commented Mar 26, 2024

Fix #231 .

Regression Test

Platforms

  • windows
  • macOS
  • linux

Hosts

Functions

  • Use GitLink(!) to copy git link (or open in browser).
  • Use GitLink(!) blame to copy the /blame link (or open in browser).
  • Use GitLink(!) default_branch to open the /main//master link in browser (or open in browser).
  • Use GitLink(!) current_branch to open the current branch link in browser (or open in browser).
  • Copy git link in a symlink directory of git repo.
  • Copy git link in an un-pushed git branch, and receive an expected error.
  • Copy git link in a pushed git branch but edited file, and receive a warning says the git link could be wrong.

@linrongbin16
Copy link
Owner Author

linrongbin16 commented Mar 26, 2024

At last, this issue is fixed by adding the cwd options when calling all the git commands, this is the most correct solution.

The cwd is using the directory of current buffer/file that user is editing, if there's no buffer/file, it fallbacks to the real CWD/PWD that user's Neovim is working at.

@codecov
Copy link

codecov bot commented Mar 26, 2024

Codecov Report

Attention: Patch coverage is 75.55556% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 76.54%. Comparing base (69bafe6) to head (155a3c2).

Files Patch % Lines
lua/gitlinker/git.lua 73.91% 6 Missing ⚠️
lua/gitlinker/linker.lua 77.27% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #232      +/-   ##
==========================================
+ Coverage   73.61%   76.54%   +2.92%     
==========================================
  Files           9        9              
  Lines         815      827      +12     
==========================================
+ Hits          600      633      +33     
+ Misses        215      194      -21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Feat Request: include basename of current file when running git commnads

2 participants