Is git grep buggy - disable parallel search?

If I run the git grep n times, I get errors about 0.8 * n times.

 $ git grep foo_bar_search `git rev-list HEAD` -- dir/subdir >/dev/null fatal: unable to read tree (bc9e3369c6d6f027075e794fa11db02af3f8fb38) $ git grep foo_bar_search `git rev-list HEAD` -- dir/subdir >/dev/null fatal: unable to read tree (473a47dd3895b1db09baf4cf9463f4cbd224d5dd) $ git grep foo_bar_search `git rev-list HEAD` -- dir/subdir >/dev/null $ git grep foo_bar_search `git rev-list HEAD` -- dir/subdir >/dev/null fatal: unable to read tree (b917adbfffd1928c8f6ac0f746a4fdfcf2088029) $ git grep foo_bar_search `git rev-list HEAD` -- dir/subdir >/dev/null fatal: unable to read tree (473a47dd3895b1db09baf4cf9463f4cbd224d5dd) 

What i tried

  • works as a superuser to eliminate any problems with file protection.
  • git fsck reports nothing wrong with just a couple of dangling objects
  • clones the repo, no errors when cloning, but git grep again shows the same behavior in the clone.
  • look at some of the reported SHA1 with git cat-file , everything seems to be fine
  • Google a little

The most interesting hit of Google:

http://www.spinics.net/lists/git/msg164520.html

The message was only 3 hours. Well, if they have race conditions in git grep , this can explain everything. So do they search in parallel on multiple cores? (I have 4 here). How can I disable this without waiting for the entire machine to boot with only 1 core?

 $ git --version git version 1.7.3.4 

(What happened with OpenSUSE 11.4)

+6
source share
2 answers

It appears that any of the following conditions will disable threads in git -grep:

  • -O provided to open the corresponding files in the pager.
  • NO_PTHREADS determined at compile time.
  • -p indicates the name of the function as a context.

We hope that the last one will be unobtrusive for your workflow.

+1
source

If you can, compiling git with the proposed patch seems to fix the race issue. It seems that there is no way to disable parallelization.

0
source

Source: https://habr.com/ru/post/896334/


All Articles