sboulema / TGit

Control TortoiseGit from within Visual Studio
MIT License
31 stars 9 forks source link

VS2019 - Switching solutions disables TGIT #59

Open MartinL0815 opened 5 years ago

MartinL0815 commented 5 years ago

If I open another solution from the VS2019 file menu TGIT disables all functions. If I re-open the previous loaded solution, TGIT returns from completely disabled to enabled.

MartinL0815 commented 5 years ago

I was surprised to see, that seemly one specific solution does not allow "global" (solution-wide" git commands, but document-only commands! What prevents in a specific solution, the global commands and allow document commands?

sboulema commented 5 years ago

It tries to find the .git folder in the solution folder. It caches if it was able to find the folder for 30 seconds. So that might cause a problem while switching solutions.

MartinL0815 commented 5 years ago

I know now the difference between the "old" and this "new" branch. It is created as worktree, has no ".git" folder, but a ".git" file.

Eventually … https://stackoverflow.com/questions/53796823/git-directory-in-git-worktree-not-a-directory … tells the needed things to enable the TGit commands in the worktree branch (not cloned).

MartinL0815 commented 5 years ago

The "correct" .git folder is for this worktree branch in "..\master.git\worktrees\PS-15.1"

And the .git file points with its content to it:

 gitdir: C:/Development/git/…/Master/.git/worktrees/PS-15.1
sboulema commented 5 years ago

Thanks for the info! Very helpful. Should be ready to parse the .git file and use that info in the extension.

Will look into adding that in the next version :)

Documentation: Git Repository Layout

Note: Also you can have a plain text file .git at the root of your working tree, containing gitdir: to point at the real directory that has the repository.

MartinL0815 commented 4 years ago

Do you have a plan, when to publish a next version, fixing this issue, which you categorized as enhancement? Thanks!

sboulema commented 4 years ago

Sorry no plan yet. Really busy with personal live at the moment (my daughter was born ❤️), so hard to find time to work on the extension :(

So for now the best I can promise: It is on my todo list and will not forget about it!

sboulema commented 4 years ago

Found some spare time at work, try the new release 🚀 !

https://github.com/sboulema/TGit/releases/tag/v4.15.69

MartinL0815 commented 4 years ago

Oh wow, you found some spare time to get this issue resolved 👍 and I was from Dec. 16th out of office and unable to check this release. :( Sadly the issue is not resolved, since the path to the repository gets build in a wrong way:

path error message

In the path of the .git file points to a directory, where the gitdir file is in, which itself contains the path to the original repository I work with.

So the needed steps are:

  1. detect if the file .git exists instead of a directory
  2. read .git file to get the path to gitdir file
  3. read gitdir file in the directory read in step 2

I'm really sorry, that I wasn't able to validate your quickly provided fix, created in the really seldom spare time as young father!

I hope, that you and your family had a good end of 2019 and a good start into 2020! All the best!

sboulema commented 4 years ago

Try the new release: https://github.com/sboulema/TGit/releases/tag/v4.15.72 🚀

Could you send me your gitdir file, can't find much about the format of the file content? You can reach me at vsix@sboulema.nl

MartinL0815 commented 4 years ago

I tried the next version and it seems to work after an error message after opening initially the TGIT menu:

Error on initial opening of TGIT menu

The gitdir is very simple, only containing the path in the first line and an empty new line:

C:/Development/git/…/PS-15.1/.git (gitdir.txt)

Thanks for your work to solve this issue!!! 👍

Dschaehn commented 2 years ago

I think the solution is even simpler, you can just check for the .git file as you do it for the .git directory, see #77

I dont' have much experience with git (we just switched to it), but with the fix from above my TortoiseGit works well for worktrees. I tested it with TortoiseGit 2.13.0.1 and git version 2.37.1.windows.1.

sboulema commented 2 years ago

Thanks for the PR!