Git Product home page Git Product logo

Comments (8)

rafikdraoui avatar rafikdraoui commented on May 31, 2024 2

I think the problem is caused by this line:

let file = fnamemodify(file, ':p')

When file is empty, then fnamemodify(file, ':p') returns the full path of the cwd. This means that in some cases this can end up being wrongly set as dotgit instead of dir, which makes git-messenger fail with the "not in a git repo" error.

Changing the line to:

let file = empty(file) ? '' : fnamemodify(file, ':p')

fixes this for me, but I haven't verified if this still works for the submodules case (which I think is the reason why this was introduced). Maybe a similar check should be done for let dir = fnamemodify(dir, ':p') too.

from git-messenger.vim.

rhysd avatar rhysd commented on May 31, 2024 2

Closing as I could confirm the fix.

from git-messenger.vim.

ylmrx avatar ylmrx commented on May 31, 2024

I was working on another PR which just browse up till oblivion. But Iā€™m fully new to vimscript , and I have no idea how to have the same behavior In Windows world. @rafikdraoui ā€˜s seems like a much better option.

from git-messenger.vim.

francois-pasquier avatar francois-pasquier commented on May 31, 2024

@rhysd could you fix this?
Could @rafikdraoui solution do the trick?

Great plugin btw!

from git-messenger.vim.

rhysd avatar rhysd commented on May 31, 2024

I'm sorry for the delay. I was fixing critical issue at github-action-benchmark and prioritized moving CI to GitHub Actions.

I'm not reproducing this issue, but @rafikdraoui's comment looks helpful. I'll try to fix this.

from git-messenger.vim.

rhysd avatar rhysd commented on May 31, 2024

@ylmrx @MeisterTea @rafikdraoui Since I'm not understanding how to reproduce this, would you check 422a933 fixed this issue?

from git-messenger.vim.

rafikdraoui avatar rafikdraoui commented on May 31, 2024

I can confirm that 422a933 fixes this for me. Thanks!


Here's how I can reproduce the bug with commit d238582 (the one just before the fix). I don't have time to test with a minimal config (i.e. perhaps my vimrc or other plugins are interfering) or with vanilla vim, but maybe this could still be helpful:

$ git clone [email protected]:rhysd/git-messenger.vim.git
$ cd git-messenger.vim
$ nvim autoload/gitmessenger.vim

Then inside NeoVim:

:GitMessenger  " this works
:cd autoload
:GitMessenger  " this doesn't work

from git-messenger.vim.

rhysd avatar rhysd commented on May 31, 2024

@rafikdraoui Thank you for the detailed steps. It is very helpful for me. I also could confirm this issue was fixed by 422a933 on my local machine. I did not notice this issue because I usually set the current directory to a root of repository. I think I should add more test case to confirm relative paths work properly.

from git-messenger.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.