rbong / vim-flog

A blazingly fast, stunningly beautiful, exceptionally powerful git branch viewer for Vim/Neovim.
795 stars 22 forks source link

no longer works in git worktree directories #144

Closed heytrav closed 2 months ago

heytrav commented 2 months ago

For my workflow I checkout my repositories as bare clones under a specific folder ~/repos/bare/project.git and then create worktrees under another another directory where I do all my work (i.e. ~/code/project/<worktreebranch>.

This plugin had been working fine in this setup. However since updating yesterday it seems that it now only works in directories that are direct clones (i.e. git clone git@....../project.git).

Did something in these recent updates change the way flog figures out it is in a git project?

heytrav commented 2 months ago

Pinning my version to v2.1.0 restores functionality.

rbong commented 2 months ago

Did something in these recent updates change the way flog figures out it is in a git project?

Sort of, we're now reducing our reliance on Fugitive to make it easier to integrate other plugins, so some cases might not yet be covered. Sorry about that.

This shouldn't actually impact how it figures out it is in a Git project, but it will impact running commands and finding the root of the project.

Pinning my version to v2.1.0 restores functionality.

Let me know if pinning to v3.0.0 restores functionality, that will revert the Fugitive changes but keep all of the other v3 features.

heytrav commented 2 months ago

Yes pinning to v3.0.0 does work!

I originally hadn't specified a version and it was just on the latest master commit.

heytrav commented 2 months ago

Thanks for the quick reply!

rbong commented 2 months ago

No problem. Keeping this open just to track when this is fixed on the master branch, feel free to unsubscribe if you don't want updates for this issue.

rbong commented 2 months ago

I fixed a few edge cases, tested with submodules and work trees and it works so far. Let me know if there are any problems.

finite-state-machine commented 2 months ago

With the latest code, I'm still seeing errors running ':Flog' in the root of a worktree:

Error detected while processing function flog#cmd#Flog[7]..flog#git#GetWorkdir[3]..flog#git#GetWorkdirFrom:
line   10:
E730: Using a List as a String
E282: Cannot read from "<temporary directory>/3"

Directory layout:

research/
research/_repo
research/project1 - worktree of '_repo'     <-- current directory when running ':Flog'
rbong commented 2 months ago

With the latest code, I'm still seeing errors running ':Flog' in the root of a worktree:

This was caused by a recent change in how shell commands were run actually. Sorry about that. Should be fixed on master.

I also improved handling when Flog is not in the worktree.

Please let me know if there are any more issues.

joaodefelipe commented 1 month ago

I believe this might be related (as going back to v3.0.0 also fixes it), but running :Flog inside a submodule tree renders the graph for the superproject instead.

rbong commented 1 month ago

@joaodefelipe Thank you for reporting. Unfortunately I cannot recreate this.

Opening :Flog while the working directory is in the submodule and/or when a file from the submodule is open shows the submodule history. The same is true for the superproject. This seems to work regardless of where the submodule is located.

Please post steps to recreate if you can. This is how I'm trying to recreate it currently:

mkdir superproject
cd superproject
git init
mkdir submodule
cd submodule
git init
touch README.md
git add README.md
git commit -m "Initial commit in submodule"
cd ..
git submodule add ./submodule submodule
git commit -m "Add submodule"

Please also make sure you are on version d58ee18 (latest commit on master at time of writing).

joaodefelipe commented 1 month ago

My bad. To reproduce it, use the same steps as you outlined above, but run git submodule absorbgitdirs at the end.

The resulting layout is what one gets by default after cloning any superproject and running git submodule update --init --recursive (or something equivalent). Similarly to a worktree, superproject/submodule/.git is a regular file referencing the "real" gitdir.

rbong commented 1 month ago

It should be fixed once you update. Thanks again for reporting

finite-state-machine commented 1 month ago

Thanks for all of your hard work on this, @rbong!