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

[Question] Is there any way to manage Git dir? #2350

Open
KSR-Yasuda opened this issue Oct 23, 2024 · 1 comment
Open

[Question] Is there any way to manage Git dir? #2350

KSR-Yasuda opened this issue Oct 23, 2024 · 1 comment

Comments

@KSR-Yasuda
Copy link
Contributor

By some command or variable,
could I { reset , force-set , check } Git dir that fugitive script manages?

Accidentally, sometimes it misunderstands Git root dir.

No specific way to reproduce, but, for example, likely to happen in the cases below:

  • In a parent repo A as the working dir, open a file in a submodule repo B.
    • It may get wrong b:git_dir as the repo A,
      while it should be the repo B the file actually belongs to.
  • Manage a repo that is in a symbolic link dir,
    and the repo setting is mixed with the symbolic-link path and the actual path.
    • Worked in a symbolic link dir /c/.../symlink/ to the actual dir /d/.../actual.
    • In a parent repo A, git clone-ed a repo B and git submodule add-ed to the repo A.
      Then, git submodule absorbgitdirs-ed to move the .git dir of the submodule repo B
      into the .git dir of the parent repo A.
    • Then, I got the .git file of repo B gitdir: ../.../../d/.../actual/repoA/.git/modules/repoB;
      and the config setting of repo B core.worktree as ../.../../c/.../symlink/repoA/repoB or such.
    • The both points to the different path in the literal sense, fugitive works bad.
      • Gdiff does not work to show the target file itself instead of the file of the head commit,
        as it gets different git root dir and file path
        • In fugitive#Path(url, ...),
          the tree path and the file path url are obtained in literally-different paths each other.

Once it goes wrong, perhaps it memorize the status somewhere,
it hard to correct the wrong Git root dir path except restarting Vim.

To cover up such cases, can I manage the Git root dir manually?

@tpope
Copy link
Owner

tpope commented Nov 19, 2024

There's no support for "covering up" Fugitive's Git dir/work tree detection. If you think there's a bug, the solution is to track it down and fix it. It might have something to do with this line, which might need a call to resolve():

return simplify(a:git_dir[0:-5] . file_dir)

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

No branches or pull requests

2 participants