Vscode-git-graph: Depth-search for repositories does not work in Workspaces

Created on 28 Aug 2019  ยท  4Comments  ยท  Source: mhutchie/vscode-git-graph

Describe the Bug
Depth-search for repositories does not work in Workspaces.
This used to work brilliantly with Git-Graph 1.12.1 and previous versions. In fact, a downgrade fixes this behaviour, so it is not a problem with my version of VsCode.

Steps to Reproduce
Steps to reproduce the behaviour:

  1. set git-graph.maxDepthOfRepoSearch to 10
  2. create a folder structure like this:
$ pwd                                                                                                                                                                                         
/tmp/git_graph_test
$ tree -a -L 4                                                                                                                                                                                
.
โ”œโ”€โ”€ one
โ”‚ย ย  โ””โ”€โ”€ folder
โ”‚ย ย      โ”œโ”€โ”€ repo1
โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ .git
โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ what.txt
โ”‚ย ย      โ””โ”€โ”€ repo2
โ”‚ย ย        ย ย โ”œโ”€โ”€ ever.txt
โ”‚ย ย        ย ย โ””โ”€โ”€ .git
โ”œโ”€โ”€ two
โ”‚   โ””โ”€โ”€ folder
โ”‚       โ””โ”€โ”€ repo3
โ”‚           โ”œโ”€โ”€ .git
โ”‚           โ””โ”€โ”€ something.txt
โ””โ”€โ”€ workspace.code-workspace
  1. the content of workspace.code-workspace should be like this:
{
    "folders": [
        {"path": "/tmp/git_graph_test/one/folder"},
        {"path": "/tmp/git_graph_test/two/folder"}
    ]
}
  1. open workspace.code-workspace as a workspace in VsCode
  2. open the Git-Graph View
  3. see that there will not be all three repos listed

Expected Behaviour
All repositorys in the workspace should be listed, and this does work in previous versions.

Environment

  • Git Graph Extension Version: 1.13.0
  • Visual Studio Code Version: 1.38.0-insider
  • Operating System: Ubuntu 18.04.3 LTS

Additional Context (optional)
Output of Git-graph:

[2019-08-28 11:18:39.322] Starting Git Graph ...
[2019-08-28 11:18:39.350] Using git (version: 2.23.0)
[2019-08-28 11:18:39.361] > git rev-parse --show-toplevel
[2019-08-28 11:18:39.362] Started Git Graph - Ready to use!
[2019-08-28 11:18:39.363] Transferred repo state: /tmp/git_graph_test/two/folder/repo3 -> /.
[2019-08-28 11:18:39.363] Searching workspace for new repos ...
[2019-08-28 11:18:39.372] > git rev-parse --show-toplevel
[2019-08-28 11:18:39.476] > git rev-parse --show-toplevel
[2019-08-28 11:18:39.486] > git rev-parse --show-toplevel
[2019-08-28 11:18:39.498] Added new repo: /tmp/git_graph_test/one/folder/repo1
[2019-08-28 11:18:39.498] Added new repo: /.
[2019-08-28 11:18:39.509] > git rev-parse --show-toplevel
[2019-08-28 11:18:39.598] > git rev-parse --show-toplevel
[2019-08-28 11:18:39.607] Added new repo: /.
[2019-08-28 11:18:39.607] Completed searching workspace for new repos
[2019-08-28 11:18:50.750] Created Git Graph View
[2019-08-28 11:18:51.078] > git branch -a --no-color
[2019-08-28 11:18:51.089] > git rev-parse --show-toplevel
[2019-08-28 11:18:51.090] Started watching repo: /.
[2019-08-28 11:18:51.104] > git rev-parse --show-toplevel
[2019-08-28 11:18:51.122] > git rev-parse --show-toplevel
[2019-08-28 11:18:51.123] Removed repo: /.
[2019-08-28 11:18:51.137] > git branch -a --no-color
[2019-08-28 11:18:51.141] Stopped watching repo: /.
[2019-08-28 11:18:51.141] Started watching repo: /tmp/git_graph_test/one/folder/repo1
[2019-08-28 11:18:51.158] > git log --max-count=301 --format=... --date-order --branches --tags --remotes HEAD
[2019-08-28 11:18:51.175] > git show-ref -d --head
[2019-08-28 11:18:51.193] > git remote
[2019-08-28 11:18:51.205] > git status -s --branch --untracked-files --porcelain
[2019-08-28 11:18:54.696] Stopped watching repo: /tmp/git_graph_test/one/folder/repo1
[2019-08-28 11:18:54.696] Disposed Git Graph View
[2019-08-28 11:19:39.933] Created Git Graph View
[2019-08-28 11:19:40.247] > git branch -a --no-color
[2019-08-28 11:19:40.249] Started watching repo: /tmp/git_graph_test/one/folder/repo1
[2019-08-28 11:19:40.283] > git log --max-count=301 --format=... --date-order --branches --tags --remotes HEAD
[2019-08-28 11:19:40.298] > git show-ref -d --head
[2019-08-28 11:19:40.312] > git remote
[2019-08-28 11:19:40.323] > git status -s --branch --untracked-files --porcelain
[2019-08-28 11:24:54.769] Stopped watching repo: /tmp/git_graph_test/one/folder/repo1
[2019-08-28 11:32:44.222] > git branch -a --no-color
[2019-08-28 11:32:44.225] Started watching repo: /tmp/git_graph_test/one/folder/repo1
[2019-08-28 11:32:44.239] > git log --max-count=301 --format=... --date-order --branches --tags --remotes HEAD
[2019-08-28 11:32:44.253] > git show-ref -d --head
[2019-08-28 11:32:44.270] > git remote
[2019-08-28 11:32:44.279] > git status -s --branch --untracked-files --porcelain

Also note, in the dropdown-menu sometimes appears a repository with the name of /., which dissappears after some time. Did not see/notice that in previous versions.

bug

All 4 comments

Thanks for identifying this, and providing such clear instructions to replicate it.

I've been able to reproduce this issue on Linux only, as I've found that it doesn't occur on Windows or Mac. I'll have a look into what might be causing this (interesting that it seems platform specific), and get a fix available for this asap.

I've just released a fix for this in v1.14.0-beta.2, which will be available in the full release v1.14.0 by 02/09/2019 (this coming Monday morning).

The issue was unrelated to the repository search, it just so happened that it was the most impacted. It was caused by a race condition in the stdout buffer of the spawned git command used to retrieve the absolute path of repos in the repo search. It only occurred on some platforms, for some workspace structures, during high CPU load.

You can download v1.14.0-beta.2, and install it following the instructions provided here.

Please confirm that this has resolved the issue for you.

I can confirm the fix working for my Workspaces where I first noticed, so looking good!
Thanks a lot for the quick fix!

Thanks @Konsonanz for confirming that this issue if resolved for you!

Was this page helpful?
0 / 5 - 0 ratings