0

I'm currently working on a repo that has thousands of refs, and when trying to change branches using the vscode UI I get the error :

Git : Maximun stack exceeded

When looking at the git logs I see enter image description here

This is where it seems to fail.

EDIT: Now seems to be outputting other error, using that command in the terminal outputs the path to the repo but seems to be failing and stuck in some sort of loop.

2023-06-08 17:34:17.623 [info] > git for-each-ref --format=%(refname)%00% (upstream: short) %00% (objectname)%00% (upstream:track) %00% (upstream: remotename)%00% (upstream: remoteref) refs/heads/24s/green
refs/remotes/24s/green [2ms]
2023-06-08 17:34:17.623 [info] > git status -z -uall [442ms]
2023-06-08 17:34:17.623 [info] › git check-ignore -v -z --stdin [149ms]
2023-06-08 17:34:17.623 [info] › git rev-parse --show-toplevel [19ms]
2023-06-08 17:34:17.623 [info] fatal: not a git repository (or any of the parent directories): .git
2023-06-08 17:34:19.920 [info] › git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [2334ms]
2023-06-08 17:34:23.237 [info] > git rev-parse --show-toplevel [3ms]
2023-06-08 17:34:23.237 [info] fatal: not a git repository (or any of the parent directories): .git
2023-06-08 17:34:44.719 [info] › git rev-parse --show-toplevel [3ms]
2023-06-08 17:34:44.719 [info] fatal: not a git repository (or any of the parent directories): .git
2023-06-08 17:34:46.711 [info] › git rev-parse --show-toplevel [11ms]
2023-06-08 17:34:46.757 [info] > git rev-parse --show-toplevel [1ms]
2023-06-08 17:34:46.802 [info] › git rev-parse --show-toplevel [1ms]
2023-06-08 17:34:46.845 [info] › git rev-parse --show-toplevel [2ms]
2023-06-08 17:34:46.888 [info] > git rev-parse --show-toplevel [1ms]
2023-06-08 17:34:46.932 [info] > git rev-parse --show-toplevel [1ms]
2023-06-08 17:34:46.976 [info] > git rev-parse --show-toplevel [1ms]
2023-06-08 17:34:47.029 [info] > git rev-parse --show-toplevel [2ms]
2023-06-08 17:34:47.072 [info] › git rev-parse --show-toplevel [2ms]
2023-06-08 17:34:47.117 [info] › git rev-parse --show-toplevel [2ms]

Any idea on how to fix it?

  • removing old refs is not an option? – eftshift0 Jun 08 '23 at 13:21
  • It might be an option but I'm not sure how to do it. Would that remove anything in remote origin? – Adrián Núñez Martínez Jun 08 '23 at 13:30
  • If those are remote references then I do not think removing them _locally_ (which is possible) would help much... next time you fetch, they will come back. – eftshift0 Jun 08 '23 at 13:34
  • Then there should be a limit to the refs git can read with that command and some way to up it I guess – Adrián Núñez Martínez Jun 08 '23 at 13:35
  • Are you sure it's a `git` problem? You are looking at it **though** VScode. Can you run a straight `git` command and see it fail? Not saying that it's _not_ a `git` problem... it's just that you have a thick layer of software between you and `git`. – eftshift0 Jun 08 '23 at 13:57
  • I don't really know abot that, makes sense tho. $ git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) bash: syntax error near unexpected token `(' But this was working yesterday for some reason. Last time I faced this issue I did fix it using git remote prune origin but doesn't work anymore and I kinda need a premanent solution :( – Adrián Núñez Martínez Jun 08 '23 at 14:10
  • Can you switch branches using git on the console? – eftshift0 Jun 08 '23 at 14:12
  • Yes, seems like vscode performs more commands in order to show the branch list when changing branches. – Adrián Núñez Martínez Jun 08 '23 at 14:13
  • Sounds like a _permanent solution_ to me. – eftshift0 Jun 08 '23 at 14:13
  • The problem is that I'm working in a **huge** repo and making vscode work again is a must to me – Adrián Núñez Martínez Jun 08 '23 at 14:16
  • Well... perhaps there's a fancy solution to the problem _but_ if wll you need is to be able to move forward till you find a _final_ fix, you could use a _middle tier_ local repo (say, the one you have right now that you use to keep track of the remote branches) and a separate (also local) repo where you only interact with the middle tier one and then you would only see the branches in the _local_ middle tier repo without the burden of having to deal with the mountain of remote branches.... then VSCode should not complain, right? Not ideal (actually, sounds annoying), but it should work. – eftshift0 Jun 08 '23 at 14:29
  • just changing branches by the terminal is not a big deal and you have tab-completion, VSC will pick up the new branch setting, no need to sort all of them – rioV8 Jun 08 '23 at 14:33
  • if you do the `git for-each` command on the terminal don't you need to quote the argument of `--format`, see the examples in the `for-each-ref` doc page – rioV8 Jun 08 '23 at 14:36
  • without the format section outputs all the refs, that seems to work – Adrián Núñez Martínez Jun 08 '23 at 14:40
  • 1) out of curiosity, what if you run [`git gc`](https://git-scm.com/docs/git-gc)? see also https://stackoverflow.com/q/1398919/11107541 2) Can you please read about [the problems with images of text](//meta.stackoverflow.com/a/285557/11107541) and then [edit] to **convert** your images of text into actual text? Likely useful: [/help/formatting](/help/formatting) – starball Jun 08 '23 at 20:33
  • @starball Thanks! I'll try it out tomorrow. – Adrián Núñez Martínez Jun 08 '23 at 20:38
  • No luck, vscode seems to be getting stuck and executing that command in a loop. Executing that command from the terminal in the same path seems to work tho. – Adrián Núñez Martínez Jun 09 '23 at 06:55

0 Answers0